changeset 18795:79b689ff168d v8.1.2386

patch 8.1.2386: 'wincolor' is not used for 'listchars' Commit: https://github.com/vim/vim/commit/42e931b0f52679d51de1a3832d1f2481512408fb Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 4 19:08:50 2019 +0100 patch 8.1.2386: 'wincolor' is not used for 'listchars' Problem: 'wincolor' is not used for 'listchars'. Solution: Combine the colors. (closes https://github.com/vim/vim/issues/5308)
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 Dec 2019 19:15:04 +0100
parents 99f9d7930215
children 1691d9177295
files src/drawline.c src/testdir/dumps/Test_wincolor_lcs.dump src/testdir/test_highlight.vim src/version.c
diffstat 4 files changed, 46 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1222,7 +1222,6 @@ win_line(
 		    c_extra = NUL;
 		    c_final = NUL;
 		    n_extra = (int)STRLEN(sbr);
-		    char_attr = HL_ATTR(HLF_AT);
 		    need_showbreak = FALSE;
 		    vcol_sbr = vcol + MB_CHARLEN(sbr);
 		    // Correct end of highlighted area for 'showbreak',
@@ -1230,7 +1229,7 @@ win_line(
 		    if (tocol == vcol)
 			tocol += n_extra;
 		    // combine 'showbreak' with 'wincolor'
-		    char_attr = hl_combine_attr(win_attr, char_attr);
+		    char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
 #  ifdef FEAT_SYN_HL
 		    // combine 'showbreak' with 'cursorline'
 		    if (cul_attr != 0)
@@ -1701,7 +1700,8 @@ win_line(
 			if (area_attr == 0 && search_attr == 0)
 			{
 			    n_attr = n_extra + 1;
-			    extra_attr = HL_ATTR(HLF_8);
+			    extra_attr = hl_combine_attr(
+						     win_attr, HL_ATTR(HLF_8));
 			    saved_attr2 = char_attr; // save current attr
 			}
 		    }
@@ -1770,7 +1770,8 @@ win_line(
 			    if (area_attr == 0 && search_attr == 0)
 			    {
 				n_attr = n_extra + 1;
-				extra_attr = HL_ATTR(HLF_8);
+				extra_attr = hl_combine_attr(
+						     win_attr, HL_ATTR(HLF_8));
 				saved_attr2 = char_attr; // save current attr
 			    }
 			    mb_c = c;
@@ -1814,7 +1815,7 @@ win_line(
 		    if (area_attr == 0 && search_attr == 0)
 		    {
 			n_attr = n_extra + 1;
-			extra_attr = HL_ATTR(HLF_AT);
+			extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
 			saved_attr2 = char_attr; // save current attr
 		    }
 		    mb_c = c;
@@ -1969,7 +1970,7 @@ win_line(
 		    if (area_attr == 0 && search_attr == 0)
 		    {
 			n_attr = 1;
-			extra_attr = HL_ATTR(HLF_8);
+			extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
 			saved_attr2 = char_attr; // save current attr
 		    }
 		    mb_c = c;
@@ -1989,7 +1990,7 @@ win_line(
 		    if (!attr_pri)
 		    {
 			n_attr = 1;
-			extra_attr = HL_ATTR(HLF_8);
+			extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
 			saved_attr2 = char_attr; // save current attr
 		    }
 		    mb_c = c;
@@ -2127,7 +2128,7 @@ win_line(
 			    c_extra = lcs_tab2;
 			c_final = lcs_tab3;
 			n_attr = tab_len + 1;
-			extra_attr = HL_ATTR(HLF_8);
+			extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
 			saved_attr2 = char_attr; // save current attr
 			mb_c = c;
 			if (enc_utf8 && utf_char2len(c) > 1)
@@ -2198,7 +2199,7 @@ win_line(
 		    --ptr;	    // put it back at the NUL
 		    if (!attr_pri)
 		    {
-			extra_attr = HL_ATTR(HLF_AT);
+			extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
 			n_attr = 1;
 		    }
 		    mb_c = c;
@@ -2244,7 +2245,7 @@ win_line(
 		    if (!attr_pri)
 		    {
 			n_attr = n_extra + 1;
-			extra_attr = HL_ATTR(HLF_8);
+			extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
 			saved_attr2 = char_attr; // save current attr
 		    }
 		    mb_utf8 = FALSE;	// don't draw as UTF-8
@@ -2503,7 +2504,7 @@ win_line(
 		c_final = NUL;
 		n_extra = 1;
 		n_attr = 2;
-		extra_attr = HL_ATTR(HLF_AT);
+		extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
 	    }
 	    mb_c = c;
 	    if (enc_utf8 && utf_char2len(c) > 1)
@@ -2517,7 +2518,7 @@ win_line(
 	    if (!attr_pri)
 	    {
 		saved_attr3 = char_attr; // save current attr
-		char_attr = HL_ATTR(HLF_AT); // later copied to char_attr
+		char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
 		n_attr3 = 1;
 	    }
 	}
@@ -2725,7 +2726,7 @@ win_line(
 		    || (n_extra && (c_extra != NUL || *p_extra != NUL))))
 	{
 	    c = lcs_ext;
-	    char_attr = HL_ATTR(HLF_AT);
+	    char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
 	    mb_c = c;
 	    if (enc_utf8 && utf_char2len(c) > 1)
 	    {
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_wincolor_lcs.dump
@@ -0,0 +1,8 @@
+|<+0#4040ff13#ffff4012| +0#0000001&@73
+|-+0#0000e05&@2|>|-@6>s+0#0000001&|o|m|e|.+0#0000e05&|r+0#0000001&|a|n|d|o|m|.+0#0000e05&|*+0#e0e0e08#6c6c6c255|.+0#0000e05#ffff4012|e+0#0000001&|n|o|u|g|h|.+0#0000e05&|l+0#0000001&|o|n|g|.+0#0000e05&|t+0#0000001&|o|.+0#0000e05&|s+0#0000001&|h|o|w|.+0#0000e05&|'+0#0000001&|e|x|t|e|n|d|s|'|.+0#0000e05&|a+0#0000001&|n|d|.+0#0000e05&|'+0#0000001&|p|r|e|c|e|d|e|s|'|.+0#0000e05&|i+0#0000001&|n|c|l|>+0#4040ff13&
+|<| +0#0000001&@73
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000#ffffff0@56|2|,|3|-|1|7| @7|A|l@1| 
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -620,6 +620,28 @@ func Test_wincolor()
   call delete('Xtest_wincolor')
 endfunc
 
+func Test_wincolor_listchars()
+  CheckScreendump
+
+  let lines =<< trim END
+	call setline(1, ["one","\t\tsome random text enough long to show 'extends' and 'precedes' includingnbsps, preceding tabs and trailing spaces    ","three"])
+	set wincolor=Todo
+	set nowrap cole=1 cocu+=n
+	set list lcs=eol:$,tab:>-,space:.,trail:_,extends:>,precedes:<,conceal:*,nbsp:#
+	call matchadd('Conceal', 'text')
+	normal 2G5zl
+  END
+  call writefile(lines, 'Xtest_wincolorlcs')
+  let buf = RunVimInTerminal('-S Xtest_wincolorlcs', {'rows': 8})
+
+  call VerifyScreenDump(buf, 'Test_wincolor_lcs', {})
+
+  " clean up
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+  call delete('Xtest_wincolorlcs')
+endfunc
+
 func Test_colorcolumn()
   CheckScreendump
 
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2386,
+/**/
     2385,
 /**/
     2384,