1
1

tweaks: stop evaluating a rule when the match is offscreen to the right

When the match of a coloring regex is beyond the width of the screen,
there is no point in continuing to evaluate the regex for the rest of
the line, because any other matches will be offscreen too.

This will save some time when there are several overlong lines.
Этот коммит содержится в:
Benno Schulenberg 2021-01-24 12:31:52 +01:00
родитель 9d8388e836
Коммит 055e262b56

Просмотреть файл

@ -2524,10 +2524,14 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
match.rm_eo += index;
index = match.rm_eo;
/* If the matching part is not visible, skip it. */
if (match.rm_eo <= from_x || match.rm_so >= till_x)
/* If the match is offscreen to the left, skip to next. */
if (match.rm_eo <= from_x)
continue;
/* If the match is off to the right, this rule is done. */
if (match.rm_so >= till_x)
break;
start_col = (match.rm_so <= from_x) ?
0 : wideness(line->data,
match.rm_so) - from_col;