commit 895de17a582f4298a9e2af85bf2c9ea2aa58108e
parent b202966d3084bf89d7a8b64a72108dc58e908bf0
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 22 Jan 2021 12:05:18 +0100
color: do not look for another 'end' match after already finding one
When reaching end-of-line after having found a zero-width end match,
nano should not continue at 'seek-an-end' but instead at 'step_two':
going on to seek a start match in the current line.
(There is no bug report, because I cannot figure out how to trigger
this issue and cause nano to misbehave. The problem was found while
reviewing the comments.)
Bug existed since commit 9a4a5454 from four years ago,
but the behavior was poorer before that commit.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/winio.c b/src/winio.c
@@ -2602,7 +2602,7 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
if (startmatch.rm_so == startmatch.rm_eo &&
endmatch.rm_so == endmatch.rm_eo) {
if (start_line->data[index] == '\0')
- break;
+ goto step_two;
index = step_right(start_line->data, index);
}
/* If there is no later start on this line, next step. */