diff src/drawline.c @ 18570:0ac88fdbf089 v8.1.2279

patch 8.1.2279: computation of highlight attributes is too complicated Commit: https://github.com/vim/vim/commit/dbd4316806389e3c2240b48cc6c4d209cb1665fd Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 9 21:28:14 2019 +0100 patch 8.1.2279: computation of highlight attributes is too complicated Problem: Computation of highlight attributes is too complicated. Solution: Simplify the attribute computation and make it more consistent. (closes #5190) Fix that 'combine' set to zero doesn't work.
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Nov 2019 21:30:03 +0100
parents 3ebb15e3c28d
children 8b0114ffde2b
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1470,6 +1470,16 @@ win_line(
 # endif
 		}
 	    }
+# ifdef FEAT_TEXT_PROP
+	    // Combine text property highlight into syntax highlight.
+	    if (text_prop_type != NULL)
+	    {
+		if (text_prop_combine)
+		    syntax_attr = hl_combine_attr(syntax_attr, text_prop_attr);
+		else
+		    syntax_attr = text_prop_attr;
+	    }
+# endif
 #endif
 
 	    // Decide which of the highlight attributes to use.
@@ -1479,28 +1489,16 @@ win_line(
 	    {
 		char_attr = hl_combine_attr(line_attr, area_attr);
 # ifdef FEAT_SYN_HL
-		if (syntax_attr != 0)
-		    char_attr = hl_combine_attr(syntax_attr, char_attr);
+		char_attr = hl_combine_attr(syntax_attr, char_attr);
 # endif
 	    }
 	    else if (search_attr != 0)
 	    {
 		char_attr = hl_combine_attr(line_attr, search_attr);
 # ifdef FEAT_SYN_HL
-		if (syntax_attr != 0)
-		    char_attr = hl_combine_attr(syntax_attr, char_attr);
+		char_attr = hl_combine_attr(syntax_attr, char_attr);
 # endif
 	    }
-# ifdef FEAT_TEXT_PROP
-	    else if (text_prop_type != NULL)
-	    {
-		char_attr = hl_combine_attr(line_attr != 0
-						? line_attr
-						: syntax_attr != 0
-						    ? syntax_attr
-						    : win_attr, text_prop_attr);
-	    }
-# endif
 	    else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
 				|| vcol < fromcol || vcol_prev < fromcol_prev
 				|| vcol >= tocol))
@@ -1508,11 +1506,10 @@ win_line(
 		// Use line_attr when not in the Visual or 'incsearch' area
 		// (area_attr may be 0 when "noinvcur" is set).
 # ifdef FEAT_SYN_HL
-		if (syntax_attr != 0)
-		    char_attr = hl_combine_attr(syntax_attr, line_attr);
-		else
+		char_attr = hl_combine_attr(syntax_attr, line_attr);
+# else
+		char_attr = line_attr;
 # endif
-		    char_attr = line_attr;
 		attr_pri = FALSE;
 	    }
 #else
@@ -1524,22 +1521,10 @@ win_line(
 	    else
 	    {
 		attr_pri = FALSE;
-#ifdef FEAT_TEXT_PROP
-		if (text_prop_type != NULL)
-		{
-		    if (text_prop_combine)
-			char_attr = hl_combine_attr(
-						  syntax_attr, text_prop_attr);
-		    else
-			char_attr = hl_combine_attr(
-						  win_attr, text_prop_attr);
-		}
-		else
-#endif
 #ifdef FEAT_SYN_HL
-		    char_attr = syntax_attr;
+		char_attr = syntax_attr;
 #else
-		    char_attr = 0;
+		char_attr = 0;
 #endif
 	    }
 	}