changeset 18494:04a40c1514c4 v8.1.2241

patch 8.1.2241: match highlight does not combine with 'wincolor' Commit: https://github.com/vim/vim/commit/024dbd229fa7991b7bf7ef4d0888b43ab03783f7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 2 22:00:15 2019 +0100 patch 8.1.2241: match highlight does not combine with 'wincolor' Problem: Match highlight does not combine with 'wincolor'. Solution: Apply 'wincolor' last on top of any other attribute. (closes https://github.com/vim/vim/issues/5159)
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 Nov 2019 22:15:05 +0100
parents 9b39a91bb0c6
children 9a48788bc82e
files src/drawline.c src/testdir/dumps/Test_popupwin_matches.dump src/testdir/dumps/Test_popupwin_menu_01.dump src/testdir/dumps/Test_popupwin_menu_02.dump src/testdir/dumps/Test_popupwin_menu_04.dump src/testdir/test_popupwin.vim src/version.c
diffstat 7 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -751,8 +751,6 @@ win_line(
 	win_attr = wcr_attr;
 	area_highlighting = TRUE;
     }
-    if (vi_attr != 0 && win_attr != 0)
-	vi_attr = hl_combine_attr(win_attr, vi_attr);
 
 #ifdef FEAT_TEXT_PROP
     if (WIN_IS_POPUP(wp))
@@ -1444,10 +1442,6 @@ win_line(
 			prev_syntax_attr = syntax_attr;
 		    }
 
-		    // combine syntax attribute with 'wincolor'
-		    if (syntax_attr != 0 && win_attr != 0)
-			syntax_attr = hl_combine_attr(win_attr, syntax_attr);
-
 		    if (did_emsg)
 		    {
 			wp->w_s->b_syn_error = TRUE;
@@ -1548,8 +1542,15 @@ win_line(
 #endif
 	    }
 	}
-	if (char_attr == 0)
-	    char_attr = win_attr;
+
+	// combine attribute with 'wincolor'
+	if (win_attr != 0)
+	{
+	    if (char_attr == 0)
+		char_attr = win_attr;
+	    else
+		char_attr = hl_combine_attr(win_attr, char_attr);
+	}
 
 	// Get the next character to put on the screen.
 
@@ -3140,4 +3141,3 @@ win_line(
     vim_free(p_extra_free);
     return row;
 }
-
--- a/src/testdir/dumps/Test_popupwin_matches.dump
+++ b/src/testdir/dumps/Test_popupwin_matches.dump
@@ -1,8 +1,8 @@
 |1+0#ffffff16#e000002@2| +0#0000000#ffffff0|2@2| |3@2| @63
->4+0#ffffff16#e000002@2| +0#0000000#ffffff0|5@2| |6+0&#ffff4012@2| +0&#ffffff0@63
+>4+0#4040ff13&@2| +0#0000000&|5@2| |6+0&#ffff4012@2| +0&#ffffff0@63
 |~+0#4040ff13&| @7|╔+0#0000001#ffd7ff255|═@10|╗| +0#4040ff13#ffffff0@52
 |~| @7|║+0#0000001#ffd7ff255|1+0#ffffff16#e000002@2| +0#0000001#ffd7ff255|2@2| |3@2|║| +0#4040ff13#ffffff0@52
-|~| @7|║+0#0000001#ffd7ff255|4@2| |5+0#ffffff16#e000002@2| +0#0000001#ffd7ff255|6@2|║| +0#4040ff13#ffffff0@52
+|~| @7|║+0#0000001#ffd7ff255|4@2| |5+0#4040ff13&@2| +0#0000001&|6@2|║| +0#4040ff13#ffffff0@52
 |~| @7|╚+0#0000001#ffd7ff255|═@10|╝| +0#4040ff13#ffffff0@52
 |~| @73
 |~| @73
--- a/src/testdir/dumps/Test_popupwin_menu_01.dump
+++ b/src/testdir/dumps/Test_popupwin_menu_01.dump
@@ -1,7 +1,7 @@
 >1+0&#ffffff0| @73
 |2| @73
 |3| @20|╔+0#0000001#ffd7ff255| |m|a|k|e| |a| |c|h|o|i|c|e| |f|r|o|m| |t|h|e| |l|i|s|t| |╗| +0#0000000#ffffff0@21
-|4| @20|║+0#0000001#ffd7ff255| |o+0#0000000#5fd7ff255|n|e| +0#0000001&@23| +0&#ffd7ff255|║| +0#0000000#ffffff0@21
+|4| @20|║+0#0000001#ffd7ff255| |o+0&#5fd7ff255|n|e| @23| +0&#ffd7ff255|║| +0#0000000#ffffff0@21
 |5| @20|║+0#0000001#ffd7ff255| |t|w|o| @24|║| +0#0000000#ffffff0@21
 |6| @20|║+0#0000001#ffd7ff255| |a|n|o|t|h|e|r| @20|║| +0#0000000#ffffff0@21
 |7| @20|╚+0#0000001#ffd7ff255|═@28|╝| +0#0000000#ffffff0@21
--- a/src/testdir/dumps/Test_popupwin_menu_02.dump
+++ b/src/testdir/dumps/Test_popupwin_menu_02.dump
@@ -3,7 +3,7 @@
 |3| @20|╔+0#0000001#ffd7ff255| |m|a|k|e| |a| |c|h|o|i|c|e| |f|r|o|m| |t|h|e| |l|i|s|t| |╗| +0#0000000#ffffff0@21
 |4| @20|║+0#0000001#ffd7ff255| |o|n|e| @24|║| +0#0000000#ffffff0@21
 |5| @20|║+0#0000001#ffd7ff255| |t|w|o| @24|║| +0#0000000#ffffff0@21
-|6| @20|║+0#0000001#ffd7ff255| |a+0#0000000#5fd7ff255|n|o|t|h|e|r| +0#0000001&@19| +0&#ffd7ff255|║| +0#0000000#ffffff0@21
+|6| @20|║+0#0000001#ffd7ff255| |a+0&#5fd7ff255|n|o|t|h|e|r| @19| +0&#ffd7ff255|║| +0#0000000#ffffff0@21
 |7| @20|╚+0#0000001#ffd7ff255|═@28|╝| +0#0000000#ffffff0@21
 |8| @73
 |9| @73
--- a/src/testdir/dumps/Test_popupwin_menu_04.dump
+++ b/src/testdir/dumps/Test_popupwin_menu_04.dump
@@ -1,7 +1,7 @@
 >1+0&#ffffff0| @73
 |2| @73
 |3| @31|╔+0#0000001#ffd7ff255|═@6|╗| +0#0000000#ffffff0@32
-|4| @31|║+0#0000001#ffd7ff255| |o+0#0000000#40ff4011|n|e| +0#0000001&@1| +0&#ffd7ff255|║| +0#0000000#ffffff0@32
+|4| @31|║+0#0000001#ffd7ff255| |o+0&#40ff4011|n|e| @1| +0&#ffd7ff255|║| +0#0000000#ffffff0@32
 |5| @31|║+0#0000001#ffd7ff255| |t|w|o| @2|║| +0#0000000#ffffff0@32
 |6| @31|║+0#0000001#ffd7ff255| |t|h|r|e@1| |║| +0#0000000#ffffff0@32
 |7| @31|╚+0#0000001#ffd7ff255|═@6|╝| +0#0000000#ffffff0@32
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -249,11 +249,12 @@ func Test_popup_with_matches()
 	    \ '444 555 666',
 	    \], #{line: 3, col: 10, border: []})
 	set hlsearch
+	hi VeryBlue ctermfg=blue guifg=blue
 	/666
 	call matchadd('ErrorMsg', '111')
-	call matchadd('ErrorMsg', '444')
+	call matchadd('VeryBlue', '444')
 	call win_execute(winid, "call matchadd('ErrorMsg', '111')")
-	call win_execute(winid, "call matchadd('ErrorMsg', '555')")
+	call win_execute(winid, "call matchadd('VeryBlue', '555')")
   END
   call writefile(lines, 'XtestPopupMatches')
   let buf = RunVimInTerminal('-S XtestPopupMatches', #{rows: 10})
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2241,
+/**/
     2240,
 /**/
     2239,