Skip to content

Commit

Permalink
more test with fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tsjensen committed Oct 29, 2023
1 parent 3bde7e3 commit 27306d1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,13 @@ static void match_vertical_side(remove_ctx_t *ctx, int vside, shape_line_ctx_t *
BFREE(to_free);
shape_text = NULL;

if (p == NULL) {
if ((p == NULL)
|| (vside == BLEF && ((size_t) (p - input_line) > input_indent + (max_quality - quality)))
|| (vside == BRIG && ((size_t) (p - input_line) < input_length - input_trailing - quality))) {
shape_text = shorten(*shape_line_ctx, &quality, vside == BLEF, 1, 1);
to_free = shape_text;
}
else if (vside == BLEF && ((size_t) (p - input_line) <= input_indent + (max_quality - quality))) {
else if (vside == BLEF) {
if (quality > line_ctx->west_quality) {
line_ctx->west_start = (size_t) (p - input_line);
line_ctx->west_end = line_ctx->west_start + quality;
Expand All @@ -744,7 +746,7 @@ static void match_vertical_side(remove_ctx_t *ctx, int vside, shape_line_ctx_t *
break;
}
}
else if (vside == BRIG && ((size_t) (p - input_line) >= input_length - input_trailing - quality)) {
else if (vside == BRIG) {
if (quality > line_ctx->east_quality) {
line_ctx->east_start = (size_t) (p - input_line);
line_ctx->east_end = line_ctx->east_start + quality;
Expand Down
11 changes: 11 additions & 0 deletions test/188_design_not_detectable.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:DESC
Tests that a proper error message is produced when the box design cannot be detected.

:ARGS
-r
:INPUT
foo
:OUTPUT-FILTER
:EXPECTED-ERROR 1
boxes: Box design autodetection failed. Use -d option.
:EOF
22 changes: 22 additions & 0 deletions test/189_blank_lines_surrounding_box.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:DESC
Blank lines above and below the box are retained when the box is removed.
There are some spaces in the line just above the box.

:ARGS
-r -d jstone
:INPUT


/*-------------+
| Lorem Ipsum |
+-------------*/


:OUTPUT-FILTER
:EXPECTED


Lorem Ipsum


:EOF

0 comments on commit 27306d1

Please sign in to comment.