diff src/drawline.c @ 26338:4cf208415483 v8.2.3700

patch 8.2.3700: text property highlighting continues over breakindent Commit: https://github.com/vim/vim/commit/6b839ac77586f69a814d2940f59f0125f55c5f81 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 29 21:12:35 2021 +0000 patch 8.2.3700: text property highlighting continues over breakindent Problem: Text property highlighting continues over breakindent. Solution: Stop before the end column. (closes https://github.com/vim/vim/issues/9242)
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Nov 2021 22:15:03 +0100
parents baec4e1cee43
children 13cce5c82c9a
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -265,6 +265,9 @@ win_line(
     int		c_extra = NUL;		// extra chars, all the same
     int		c_final = NUL;		// final char, mandatory if set
     int		extra_attr = 0;		// attributes when n_extra != 0
+#ifdef FEAT_LINEBREAK
+    int		in_linebreak = FALSE;	// n_extra set for showing linebreak
+#endif
     static char_u *at_end_str = (char_u *)""; // used for p_extra when
 					// displaying eol at end-of-line
     int		lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used
@@ -1419,7 +1422,11 @@ win_line(
 		int pi;
 		int bcol = (int)(ptr - line);
 
-		if (n_extra > 0)
+		if (n_extra > 0
+# ifdef FEAT_LINEBREAK
+			&& !in_linebreak
+# endif
+			)
 		    --bcol;  // still working on the previous char, e.g. Tab
 
 		// Check if any active property ends.
@@ -1437,6 +1444,11 @@ win_line(
 					 * (text_props_active - (pi + 1)));
 			--text_props_active;
 			--pi;
+# ifdef FEAT_LINEBREAK
+			// not exactly right but should work in most cases
+			if (in_linebreak && syntax_attr == text_prop_attr)
+			    syntax_attr = 0;
+# endif
 		    }
 		}
 
@@ -1705,6 +1717,10 @@ win_line(
 		++p_extra;
 	    }
 	    --n_extra;
+#ifdef FEAT_LINEBREAK
+	    if (n_extra <= 0)
+		in_linebreak = FALSE;
+#endif
 	}
 	else
 	{
@@ -2030,6 +2046,8 @@ win_line(
 
 		    c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
 		    c_final = NUL;
+		    if (n_extra > 0)
+			in_linebreak = TRUE;
 		    if (VIM_ISWHITE(c))
 		    {
 # ifdef FEAT_CONCEAL