From b94dcfd34b092bc3b83d6437eb09ca6f1bb6f2af Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 18 Feb 2021 12:02:25 +0100 Subject: [PATCH] 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. --- src/color.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/color.c b/src/color.c index 9bb5740c..5eea1d22 100644 --- a/src/color.c +++ b/src/color.c @@ -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) {