mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-01-31 18:09:16 +01:00
Bugfix: When matching vertical side shape lines, ignore empty shape lines
This commit is contained in:
parent
0f2a1703ce
commit
2d293cb89d
24
src/remove.c
24
src/remove.c
@ -4,7 +4,7 @@
|
||||
* Date created: June 23, 1999 (Wednesday, 20:59h)
|
||||
* Author: Copyright (C) 1999 Thomas Jensen
|
||||
* tsjensen@stud.informatik.uni-erlangen.de
|
||||
* Version: $Id: remove.c,v 1.2 1999/06/25 18:45:33 tsjensen Exp tsjensen $
|
||||
* Version: $Id: remove.c,v 1.3 1999/07/20 18:57:16 tsjensen Exp tsjensen $
|
||||
* Language: ANSI C
|
||||
* World Wide Web: http://home.pages.de/~jensen/boxes/
|
||||
* Purpose: Box removal, i.e. the deletion of boxes
|
||||
@ -25,6 +25,11 @@
|
||||
* Revision History:
|
||||
*
|
||||
* $Log: remove.c,v $
|
||||
* Revision 1.3 1999/07/20 18:57:16 tsjensen
|
||||
* Added GNU GPL disclaimer
|
||||
* Does not kill leading/trailing blank lines anymore when !opt.killblank
|
||||
* Added include config.h
|
||||
*
|
||||
* Revision 1.2 1999/06/25 18:45:33 tsjensen
|
||||
* Added initialization of mmok to please compiler
|
||||
* Changed parameters of empty_side() calls to comply with new signature
|
||||
@ -45,7 +50,7 @@
|
||||
#include "remove.h"
|
||||
|
||||
static const char rcsid_remove_c[] =
|
||||
"$Id: remove.c,v 1.2 1999/06/25 18:45:33 tsjensen Exp tsjensen $";
|
||||
"$Id: remove.c,v 1.3 1999/07/20 18:57:16 tsjensen Exp tsjensen $";
|
||||
|
||||
|
||||
|
||||
@ -74,6 +79,7 @@ static int best_match (const line_t *line,
|
||||
char *p; /* position found by strstr */
|
||||
size_t cq; /* current quality */
|
||||
char *q; /* space check rover */
|
||||
line_t chkline; /* for calls to empty_line() */
|
||||
size_t quality;
|
||||
|
||||
*ws = *we = *es = *ee = NULL;
|
||||
@ -102,6 +108,11 @@ static int best_match (const line_t *line,
|
||||
cs = opt.design->shape + west_side[--w];
|
||||
}
|
||||
|
||||
chkline.text = cs->chars[k];
|
||||
chkline.len = cs->width;
|
||||
if (empty_line (&chkline))
|
||||
continue;
|
||||
|
||||
s = (char *) strdup (cs->chars[k]);
|
||||
if (s == NULL) {
|
||||
perror (PROJECT);
|
||||
@ -166,6 +177,11 @@ static int best_match (const line_t *line,
|
||||
j, k, w, cs->chars[k]?cs->chars[k]:"(null)");
|
||||
#endif
|
||||
|
||||
chkline.text = cs->chars[k];
|
||||
chkline.len = cs->width;
|
||||
if (empty_line (&chkline))
|
||||
continue;
|
||||
|
||||
s = (char *) strdup (cs->chars[k]);
|
||||
if (s == NULL) {
|
||||
perror (PROJECT);
|
||||
@ -231,7 +247,7 @@ static int hmm (const int aside, const size_t follow,
|
||||
* ecs pointer to first char of east corner shape
|
||||
* cnt current shape to check (0 == leftmost middle shape)
|
||||
*
|
||||
* Recursive helper function for detect_horiz()
|
||||
* Recursive helper function for detect_horiz(), uses backtracking
|
||||
*
|
||||
* RETURNS: == 0 success
|
||||
* != 0 error
|
||||
@ -734,7 +750,7 @@ static design_t *detect_design()
|
||||
|
||||
int remove_box()
|
||||
/*
|
||||
* foo
|
||||
* Remove box from input.
|
||||
*
|
||||
* RETURNS: == 0 success
|
||||
* != 0 error
|
||||
|
Loading…
Reference in New Issue
Block a user