From 4af1da7d95d64bf85a8b9ee4e1c9c69c62f69e27 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 3 Jul 2016 16:21:03 +0200
Subject: [PATCH] color: push the resets further when start and end match are
 equal

When for a multiline syntax-coloring rule the starting regex matches at
the exact same spot as the ending regex, do a second round of resets, so
that reevaluation starts further back and gets a few more things right.

This mildly fixes https://savannah.gnu.org/bugs/?47420.
---
 src/color.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/color.c b/src/color.c
index 39355ca7..d7888697 100644
--- a/src/color.c
+++ b/src/color.c
@@ -376,6 +376,11 @@ void reset_multis(filestruct *fileptr, bool force)
 
 	/* If we got here, things have changed. */
 	reset_multis_for_id(fileptr, tmpcolor->id);
+
+	/* If start and end are the same, push the resets further. */
+	if (force == FALSE && !nobegin && !noend &&
+				startmatch.rm_so == endmatch.rm_so)
+	    reset_multis_for_id(fileptr, tmpcolor->id);
     }
 }
 
-- 
GitLab