mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-07-15 13:45:16 +02:00
Bugfix: For non-empty left box sides, spaces belonging to "empty" shape
lines were not properly removed in some cases
This commit is contained in:
18
src/remove.c
18
src/remove.c
@ -4,7 +4,7 @@
|
|||||||
* Date created: June 23, 1999 (Wednesday, 20:59h)
|
* Date created: June 23, 1999 (Wednesday, 20:59h)
|
||||||
* Author: Copyright (C) 1999 Thomas Jensen
|
* Author: Copyright (C) 1999 Thomas Jensen
|
||||||
* tsjensen@stud.informatik.uni-erlangen.de
|
* tsjensen@stud.informatik.uni-erlangen.de
|
||||||
* Version: $Id: remove.c,v 1.4 1999/08/21 16:03:31 tsjensen Exp tsjensen $
|
* Version: $Id: remove.c,v 1.5 1999/11/07 17:46:26 tsjensen Exp tsjensen $
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* World Wide Web: http://home.pages.de/~jensen/boxes/
|
* World Wide Web: http://home.pages.de/~jensen/boxes/
|
||||||
* Purpose: Box removal, i.e. the deletion of boxes
|
* Purpose: Box removal, i.e. the deletion of boxes
|
||||||
@ -25,6 +25,11 @@
|
|||||||
* Revision History:
|
* Revision History:
|
||||||
*
|
*
|
||||||
* $Log: remove.c,v $
|
* $Log: remove.c,v $
|
||||||
|
* Revision 1.5 1999/11/07 17:46:26 tsjensen
|
||||||
|
* Bugfix: Horizontal box parts were not correctly detected if the west box
|
||||||
|
* side was empty (reported: Tobias Buchal)
|
||||||
|
* Bugfix: boxes could hang in detect_horiz() due to goeast/west confusion
|
||||||
|
*
|
||||||
* Revision 1.4 1999/08/21 16:03:31 tsjensen
|
* Revision 1.4 1999/08/21 16:03:31 tsjensen
|
||||||
* Bugfix: When matching vertical side shape lines, ignore empty shape lines
|
* Bugfix: When matching vertical side shape lines, ignore empty shape lines
|
||||||
*
|
*
|
||||||
@ -53,7 +58,8 @@
|
|||||||
#include "remove.h"
|
#include "remove.h"
|
||||||
|
|
||||||
static const char rcsid_remove_c[] =
|
static const char rcsid_remove_c[] =
|
||||||
"$Id: remove.c,v 1.4 1999/08/21 16:03:31 tsjensen Exp tsjensen $";
|
"$Id: remove.c,v 1.5 1999/11/07 17:46:26 tsjensen Exp tsjensen $";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -101,8 +107,9 @@ static int best_match (const line_t *line,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find match for WEST side (TODO: nicht wenn BLEF leer)
|
* Find match for WEST side
|
||||||
*/
|
*/
|
||||||
|
if (!empty_side (opt.design->shape, BLEF)) {
|
||||||
quality = 0;
|
quality = 0;
|
||||||
cs = opt.design->shape + WNW;
|
cs = opt.design->shape + WNW;
|
||||||
for (j=0,k=0,w=3; j<numw; ++j,++k) {
|
for (j=0,k=0,w=3; j<numw; ++j,++k) {
|
||||||
@ -113,7 +120,7 @@ static int best_match (const line_t *line,
|
|||||||
|
|
||||||
chkline.text = cs->chars[k];
|
chkline.text = cs->chars[k];
|
||||||
chkline.len = cs->width;
|
chkline.len = cs->width;
|
||||||
if (empty_line (&chkline))
|
if (empty_line (&chkline) && !(quality==0 && j==numw-1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
s = (char *) strdup (cs->chars[k]);
|
s = (char *) strdup (cs->chars[k]);
|
||||||
@ -164,10 +171,12 @@ static int best_match (const line_t *line,
|
|||||||
|
|
||||||
BFREE (s);
|
BFREE (s);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find match for EAST side
|
* Find match for EAST side
|
||||||
*/
|
*/
|
||||||
|
if (!empty_side (opt.design->shape, BRIG)) {
|
||||||
quality = 0;
|
quality = 0;
|
||||||
cs = opt.design->shape + ENE;
|
cs = opt.design->shape + ENE;
|
||||||
for (j=0,k=0,w=1; j<nume; ++j,++k) {
|
for (j=0,k=0,w=1; j<nume; ++j,++k) {
|
||||||
@ -233,6 +242,7 @@ static int best_match (const line_t *line,
|
|||||||
|
|
||||||
BFREE (s);
|
BFREE (s);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return *ws || *es ? 1:0;
|
return *ws || *es ? 1:0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user