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.
Этот коммит содержится в:
родитель
9d8388e836
Коммит
055e262b56
@ -2524,10 +2524,14 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
|
|||||||
match.rm_eo += index;
|
match.rm_eo += index;
|
||||||
index = match.rm_eo;
|
index = match.rm_eo;
|
||||||
|
|
||||||
/* If the matching part is not visible, skip it. */
|
/* If the match is offscreen to the left, skip to next. */
|
||||||
if (match.rm_eo <= from_x || match.rm_so >= till_x)
|
if (match.rm_eo <= from_x)
|
||||||
continue;
|
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) ?
|
start_col = (match.rm_so <= from_x) ?
|
||||||
0 : wideness(line->data,
|
0 : wideness(line->data,
|
||||||
match.rm_so) - from_col;
|
match.rm_so) - from_col;
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user