painting: trigger fewer unneeded full-screen refreshes

When a line is marked as NOTHING, then the existence or the appearance
of an end match is irrelevant: there is no unpaired start match, so no
recoloring would occur, so there is no need to refresh.

When a line is marked as WOULDBE, then the existence or the appearance
of a start match is irrelevant (for the lines after the first WOULDBE
line): there already is an unpaired start match, so another one will
not change anything, so no refresh is needed.  Only the appearance of
an end match would recolor things and thus require a refresh.  However,
start and end regexes could match the same thing, so an end might get
misinterpreted as a start.  So the rule has to check for the absence
of both a start and an end match, like for WHOLELINE.

This addresses https://savannah.gnu.org/bugs/?60072.
master
Benno Schulenberg 2021-02-18 12:02:25 +01:00
parent 4238564673
commit b94dcfd34b
1 changed files with 4 additions and 1 deletions

View File

@ -262,7 +262,10 @@ void check_the_multis(linestruct *line)
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
/* Check whether the multidata still matches the current situation. */
if (line->multidata[ink->id] & (NOTHING|WHOLELINE)) {
if (line->multidata[ink->id] == NOTHING) {
if (!astart)
continue;
} else if (line->multidata[ink->id] & (WHOLELINE|WOULDBE)) {
if (!astart && !anend)
continue;
} else if (line->multidata[ink->id] == JUSTONTHIS) {