From: Shad Date: Wed, 22 Jul 2026 20:01:09 +0000 (+0000) Subject: patch 9.2.0837: Using wrong colors in hl_blend_attr() X-Git-Tag: v9.2.0837^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77eed379cce8fd85a1a92c5e587da7cd103751ac;p=thirdparty%2Fvim.git patch 9.2.0837: Using wrong colors in hl_blend_attr() Problem: Using wrong colors in hl_blend_attr() (after v9.2.0715) Solution: Use the correct background color (Shad) related: #20624 closes: #20704 Signed-off-by: Shad Signed-off-by: Christian Brabandt --- diff --git a/src/highlight.c b/src/highlight.c index 2e1b343291..1b9cbed7c2 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -3581,7 +3581,7 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, int blend_fg UNUSED) under_fg_rgb = char_aep->ae_u.cterm.fg_rgb; #endif new_en.ae_u.cterm.fg_color = blend_cterm_colors( - popup_aep->ae_u.cterm.fg_color, popup_bg_rgb, + popup_aep->ae_u.cterm.bg_color, popup_bg_rgb, under_fg, under_fg_rgb, fallback_fg_rgb, blend); } // Approximate cterm bg by blending with the underlying bg @@ -3815,7 +3815,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int blend UNUSED) under_fg_rgb = char_aep->ae_u.cterm.fg_rgb; #endif new_en.ae_u.cterm.fg_color = blend_cterm_colors( - popup_aep->ae_u.cterm.fg_color, popup_bg_rgb, + popup_aep->ae_u.cterm.bg_color, popup_bg_rgb, under_fg, under_fg_rgb, fallback_fg_rgb, blend); } // Approximate cterm bg by blending with the underlying bg diff --git a/src/testdir/dumps/Test_popup_opacity_lowcolor.dump b/src/testdir/dumps/Test_popup_opacity_lowcolor.dump new file mode 100644 index 0000000000..530b0cbc43 --- /dev/null +++ b/src/testdir/dumps/Test_popup_opacity_lowcolor.dump @@ -0,0 +1,12 @@ +>u+0&#ffffff0|n|d|e|r| |u|n|d|e|r| |u|n|d|e|r| @42 +|u|n|╔+0#0000001#ff40ff14|═@21|╗| +0#0000000#ffffff0@33 +|u|n|║+0#0000001#ff40ff14|e+0#ff40ff14&|r| |u|n|d|e|r| |u|n|d|e|r| @7|║+0#0000001&| +0#0000000#ffffff0@33 +|u|n|║+0#0000001#ff40ff14|e+0#ff40ff14&|P+0#0000001&|o|p|u|p|e+0#ff40ff14&|P+0#0000001&|o|p|u|p|e+0#ff40ff14&|r| @7|║+0#0000001&| +0#0000000#ffffff0@33 +|u|n|║+0#0000001#ff40ff14|e+0#ff40ff14&|r| |u|n|d|e|r| |u|n|d|e|r| @7|║+0#0000001&| +0#0000000#ffffff0@33 +|u|n|║+0#0000001#ff40ff14|e+0#ff40ff14&|r| |u|n|d|e|r| |u|n|d|e|r| @7|║+0#0000001&| +0#0000000#ffffff0@33 +|u|n|╚+0#0000001#ff40ff14|═@21|╝| +0#0000000#ffffff0@33 +|u|n|d|e|r| |u|n|d|e|r| |u|n|d|e|r| @42 +|u|n|d|e|r| |u|n|d|e|r| |u|n|d|e|r| @42 +|u|n|d|e|r| |u|n|d|e|r| |u|n|d|e|r| @42 +|~+0#4040ff13&| @58 +| +0#0000000&@41|1|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_popupwin_opacity_hl_80.dump b/src/testdir/dumps/Test_popupwin_opacity_hl_80.dump index 78d3115450..c57365eaae 100644 --- a/src/testdir/dumps/Test_popupwin_opacity_hl_80.dump +++ b/src/testdir/dumps/Test_popupwin_opacity_hl_80.dump @@ -1,7 +1,7 @@ >1+0&#ffffff0| @73 |2| @73 -|3| @7|f+0#ff404010#87d7ff255|o@1| +0#d75f5f255&@1|b+0#0000001&|a|r| +0#0000000#ffffff0@57 -|4| @7|b+0#0000001#87d7ff255|a|z| +0#0000000&@4| +0&#ffffff0@57 +|3| @7|f+0#ff404010#87d7ff255|o@1| +0#5fafd7255&@1|b+0#0000001&|a|r| +0#0000000#ffffff0@57 +|4| @7|b+0#0000001#87d7ff255|a|z| +0#5fafd7255&@4| +0#0000000#ffffff0@57 |5| @73 |6| @73 |7| @73 diff --git a/src/testdir/dumps/Test_pum_opacity_lowcolor.dump b/src/testdir/dumps/Test_pum_opacity_lowcolor.dump new file mode 100644 index 0000000000..6c585e0a87 --- /dev/null +++ b/src/testdir/dumps/Test_pum_opacity_lowcolor.dump @@ -0,0 +1,12 @@ +|i+0&#ffffff0|t|e|m> @55 +|i+0#0000001#e0e0e08|t|e|m|r+0#e0e0e08&| |u|n|d|e|r| |u|n|d|e+0#0000000#ffffff0|r| @42 +|a+0#0000001#ff40ff14|n|o|t|h|e|r| |i|t|e|m|u+0#ff40ff14&|n|d|e+0#0000000#ffffff0|r| @42 +|a+0#0000001#ff40ff14|n|d| |a| |l|a|s|t| |o|n|e|d+0#ff40ff14&|e+0#0000000#ffffff0|r| @42 +|u|n|d|e|r| |u|n|d|e|r| |u|n|d|e|r| @42 +|u|n|d|e|r| |u|n|d|e|r| |u|n|d|e|r| @42 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@29|1|,|5| @10|A|l@1| diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index fd25e93ebe..a4bba3f310 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -2706,6 +2706,29 @@ func Test_pumopt_opacity_pmenu_cleared() call StopVimInTerminal(buf) endfunc +func Test_pum_opacity_lowcolor() + CheckScreendump + + let lines =<< trim END + set pumopt=opacity:50 + call setline(1, '') + for i in range(5) + call append(line('$'), 'under under under') + endfor + normal gg + inoremap call complete(col('.'), + \ ['item', 'another item', 'and a last one']) + END + call writefile(lines, 'XtestPumOpacityLowcolor', 'D') + let buf = RunVimInTerminal('-S XtestPumOpacityLowcolor', #{rows: 12, cols: 60, tcolors: 16}) + + call term_sendkeys(buf, "i\") + call TermWait(buf, 100) + call VerifyScreenDump(buf, 'Test_pum_opacity_lowcolor', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_popup_sandbox() call assert_fails('sandbox call popup_create("hello", {})', 'E48:') call assert_fails('sandbox call popup_setoptions(1, {})', 'E48:') diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim index 67babab1b2..364a50fe02 100644 --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -5831,6 +5831,27 @@ func Test_popup_opacity_attr() call StopVimInTerminal(buf) endfunc +func Test_popup_opacity_lowcolor() + CheckScreendump + + let lines =<< trim END + call setline(1, repeat(['under under under'], 10)) + call popup_create('Popup Popup', #{ + \ line: 2, col: 3, + \ border: [1, 1, 1, 1], + \ padding: [1, 1, 1 ,1], + \ minwidth: 20, + \ minheight: 2, + \ opacity: 70, + \ }) + END + call writefile(lines, 'XtestPopupOpacityLowcolor', 'D') + let buf = RunVimInTerminal('-S XtestPopupOpacityLowcolor', #{rows: 12, cols: 60, tcolors: 16}) + call VerifyScreenDump(buf, 'Test_popup_opacity_lowcolor', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_popup_image_update() CheckFeature image diff --git a/src/testdir/util/term_util.vim b/src/testdir/util/term_util.vim index 61ff9ce1b8..afb44c8dbb 100644 --- a/src/testdir/util/term_util.vim +++ b/src/testdir/util/term_util.vim @@ -58,6 +58,7 @@ endfunc " "no_clean" - if non-zero then remove "--clean" from the command " "cmd" - run any other command, e.g. "xxd" (used in xxd test) " "env" - additional environment variables, e.g. $TERM variable +" "tcolor" - terminal color number (256 by default) func RunVimInTerminal(arguments, options) " If Vim doesn't exit a swap file remains, causing other tests to fail. " Remove it here. @@ -76,8 +77,11 @@ func RunVimInTerminal(arguments, options) split vsplit - " Always do this with 256 colors and a light background. - set t_Co=256 background=light + " Always do this with light background. + set background=light + " and 256 colors by default + let tcolors = get(a:options, 'tcolors', 256) + let &t_Co=tcolors hi Normal ctermfg=NONE ctermbg=NONE " Make the window 20 lines high and 75 columns, unless told otherwise or diff --git a/src/version.c b/src/version.c index d814250994..d463a17d81 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 837, /**/ 836, /**/