From 18ba7f60c165d271d7734cc18a4c5001cb9efb32 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 8 Mar 2022 09:39:40 +0100 Subject: [PATCH] painting: tighten the check for a lacking end match on a colored line As it's possible for the start regex to match what is actually the end match of a multiline thing (see the Python triple quotes, for example), make sure that such a detected start match is *not* an end match, just to avoid a needless full-screen refresh. --- src/color.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/color.c b/src/color.c index bad60a63..8bc5a6c5 100644 --- a/src/color.c +++ b/src/color.c @@ -262,7 +262,9 @@ void check_the_multis(linestruct *line) if (!astart) continue; } else if (line->multidata[ink->id] & (WHOLELINE|WOULDBE)) { - if (!astart && !anend) + /* Ensure that a detected start match is not actually an end match. */ + if (!anend && (!astart || regexec(ink->end, line->data, 1, + &endmatch, 0) != 0)) continue; } else if (line->multidata[ink->id] == JUSTONTHIS) { if (astart && anend && regexec(ink->start, line->data + startmatch.rm_eo +