From 895de17a582f4298a9e2af85bf2c9ea2aa58108e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 22 Jan 2021 12:05:18 +0100 Subject: [PATCH] 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. --- src/winio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/winio.c b/src/winio.c index db8b00e9..66c96344 100644 --- 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. */