From 6bd94040dff1a7120a19155f8caa5b6d1f814b1a Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 12 Feb 2017 20:28:14 +0100
Subject: [PATCH] painting: don't look at the current multidata when coloring a
 line

When coloring a line, look only at the multidata of the preceding
line, and based on that determine what to seek in the current line.

This fixes https://savannah.gnu.org/bugs/?50292.
---
 src/winio.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 97f6c16b..e1e8f886 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2436,25 +2436,8 @@ void edit_draw(filestruct *fileptr, const char *converted,
 		}
 	    }
 
-	    /* First see if the multidata was maybe already calculated. */
-	    if (fileptr->multidata[varnish->id] == CNONE)
-		goto tail_of_loop;
-	    else if (fileptr->multidata[varnish->id] == CWHOLELINE) {
-		mvwaddnstr(edit, row, margin, converted, -1);
-		goto tail_of_loop;
-	    } else if (fileptr->multidata[varnish->id] == CBEGINBEFORE) {
-		regexec(varnish->end, fileptr->data, 1, &endmatch, 0);
-		/* If the part to be coloured is not visible, skip it. */
-		if (endmatch.rm_eo <= from_x)
-		    goto tail_of_loop;
-		paintlen = actual_x(converted, strnlenpt(fileptr->data,
-						endmatch.rm_eo) - from_col);
-		mvwaddnstr(edit, row, margin, converted, paintlen);
-		goto tail_of_loop;
-	    }
-
-	    /* There is no precalculated multidata, or it is CENDAFTER or
-	     * CSTARTENDHERE.  In all cases, find out what to paint. */
+	    /* The preceding line has no precalculated multidata.  So, do
+	     * some backtracking to find out what to paint. */
 
 	    /* Assume nothing gets painted until proven otherwise below. */
 	    fileptr->multidata[varnish->id] = CNONE;
-- 
GitLab