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.
master
Benno Schulenberg 2021-01-22 12:05:18 +01:00
parent b202966d30
commit 895de17a58
1 changed files with 1 additions and 1 deletions

View File

@ -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. */