Commit: patch 9.2.0758: pum: No opacity when background not set for Popup menu group

1 view
Skip to first unread message

Christian Brabandt

unread,
3:15 PM (5 hours ago) 3:15 PM
to vim...@googlegroups.com
patch 9.2.0758: pum: No opacity when background not set for Popup menu group

Commit: https://github.com/vim/vim/commit/852cc912873a1c96f13a4aa1b4a3d6bb761b4b16
Author: Shad <shadow...@free.fr>
Date: Tue Jun 30 18:56:46 2026 +0000

patch 9.2.0758: pum: No opacity when background not set for Popup menu group

Problem: pum: When the Pmenu highlight group has no guibg/ctermbg the
popup menu becomes fully transparent.
Solution: Create an entry if no popup_attr exists (highlight group
cleared for example), and test if popup_attr exists but
without guibg/ctermbg attributes to fallback to normal bg
color. Similar to patch 9.2.0602 for popup window (Shad).

closes: #20638

Co-authored-by: Copilot <17572847...@users.noreply.github.com>
Signed-off-by: Shad <shadow...@free.fr>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/highlight.c b/src/highlight.c
index 717a8f5fb..08c0bf730 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -3683,6 +3683,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int blend UNUSED)
attrentry_T *char_aep = NULL;
attrentry_T *popup_aep;
attrentry_T new_en;
+ attrentry_T tmp_en;

#ifdef FEAT_GUI
if (gui.in_use)
@@ -3700,33 +3701,49 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int blend UNUSED)
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
- if (popup_attr > HL_ALL)
+
+ // initialize an empty entry if no highlight set for popup
+ if (popup_attr <= HL_ALL)
{
+ CLEAR_FIELD(tmp_en);
+ tmp_en.ae_u.gui.fg_color = INVALCOLOR;
+ tmp_en.ae_u.gui.bg_color = INVALCOLOR;
+ tmp_en.ae_u.gui.sp_color = INVALCOLOR;
+ // preserve attributes other than color
+ tmp_en.ae_attr = popup_attr;
+ popup_aep = &tmp_en;
+
+ popup_aep->ae_u.gui.bg_color = fallback_bg_rgb;
+ }
+ else
popup_aep = syn_gui_attr2entry(popup_attr);
- if (popup_aep != NULL)
+
+ if (popup_aep != NULL)
+ {
+ guicolor_T popup_bg_rgb = popup_aep->ae_u.gui.bg_color;
+ if (COLOR_INVALID(popup_bg_rgb))
+ popup_bg_rgb = fallback_bg_rgb;
+
+ // Blend fg: pum_bg toward underlying_fg.
+ // blend=0 (opaque): fg = pum_bg (text hidden)
+ // blend=100 (transparent): fg = underlying_fg (text visible)
{
- // Blend fg: pum_bg toward underlying_fg.
- // blend=0 (opaque): fg = pum_bg (text hidden)
- // blend=100 (transparent): fg = underlying_fg (text visible)
- if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
- {
- int base_fg = fallback_fg_rgb;
- if (char_aep != NULL
- && char_aep->ae_u.gui.fg_color != INVALCOLOR)
- base_fg = char_aep->ae_u.gui.fg_color;
- new_en.ae_u.gui.fg_color = blend_colors(
- popup_aep->ae_u.gui.bg_color, base_fg, blend);
- }
- // Blend bg: popup bg toward underlying bg.
- if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
- {
- guicolor_T underlying_bg = fallback_bg_rgb;
- if (char_aep != NULL)
- underlying_bg = char_aep->ae_u.gui.bg_color;
- new_en.ae_u.gui.bg_color = blend_colors(
- popup_aep->ae_u.gui.bg_color,
- underlying_bg, blend);
- }
+ int base_fg = fallback_fg_rgb;
+ if (char_aep != NULL
+ && char_aep->ae_u.gui.fg_color != INVALCOLOR)
+ base_fg = char_aep->ae_u.gui.fg_color;
+ new_en.ae_u.gui.fg_color = blend_colors(
+ popup_bg_rgb, base_fg, blend);
+ }
+ // Blend background color: blend popup bg toward underlying bg
+ {
+ guicolor_T underlying_bg = fallback_bg_rgb;
+ if (char_aep != NULL
+ && !COLOR_INVALID(char_aep->ae_u.gui.bg_color))
+ underlying_bg = char_aep->ae_u.gui.bg_color;
+ new_en.ae_u.gui.bg_color = blend_colors(
+ popup_bg_rgb,
+ underlying_bg, blend);
}
}
return get_attr_entry(&gui_attr_table, &new_en);
@@ -3750,70 +3767,98 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int blend UNUSED)
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
- if (popup_attr > HL_ALL)
+
+ // initialize an empty entry if no highlight set for popup
+ if (popup_attr <= HL_ALL)
{
+ CLEAR_FIELD(tmp_en);
+#ifdef FEAT_TERMGUICOLORS
+ tmp_en.ae_u.cterm.fg_rgb = INVALCOLOR;
+ tmp_en.ae_u.cterm.ul_rgb = INVALCOLOR;
+ // allow blending with termguicolors
+ tmp_en.ae_u.cterm.bg_rgb = fallback_bg_rgb;
+#endif
+ // preserve attributes other than color
+ tmp_en.ae_attr = popup_attr;
+ popup_aep = &tmp_en;
+
+ // allow blending with notermguicolors
+ popup_aep->ae_u.cterm.bg_color = cterm_normal_bg_color;
+ }
+ else
popup_aep = syn_cterm_attr2entry(popup_attr);
- if (popup_aep != NULL)
+
+ if (popup_aep != NULL)
+ {
+ guicolor_T popup_bg_rgb = INVALCOLOR;
+#ifdef FEAT_TERMGUICOLORS
+ // Fall back to cterm color converted to RGB when gui color is not set.
+ popup_bg_rgb = popup_aep->ae_u.cterm.bg_rgb;
+ if (COLOR_INVALID(popup_bg_rgb)
+ && popup_aep->ae_u.cterm.bg_color > 0)
+ popup_bg_rgb = cterm_color_to_rgb(
+ popup_aep->ae_u.cterm.bg_color);
+#endif
+ // assign default color if guibg and ctermbg are not set for popup
+ if (COLOR_INVALID(popup_bg_rgb)
+ && popup_aep->ae_u.cterm.bg_color == 0)
+ popup_bg_rgb = fallback_bg_rgb;
+
+ // Blend cterm fg: pum_bg toward underlying_fg in the
+ // 256-color palette (mirrors the fg_rgb blend below).
{
- // Blend cterm fg: pum_bg toward underlying_fg in the
- // 256-color palette (mirrors the fg_rgb blend below).
- {
- int under_fg = (char_aep != NULL)
- ? char_aep->ae_u.cterm.fg_color : 0;
- guicolor_T under_fg_rgb = INVALCOLOR;
- guicolor_T popup_bg_rgb = INVALCOLOR;
+ int under_fg = (char_aep != NULL)
+ ? char_aep->ae_u.cterm.fg_color : 0;
+ guicolor_T under_fg_rgb = INVALCOLOR;
#ifdef FEAT_TERMGUICOLORS
- if (char_aep != NULL)
- under_fg_rgb = char_aep->ae_u.cterm.fg_rgb;
- popup_bg_rgb = popup_aep->ae_u.cterm.bg_rgb;
+ if (char_aep != NULL)
+ 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,
- under_fg, under_fg_rgb, fallback_fg_rgb, blend);
- }
- // Approximate cterm bg by blending with the underlying bg
- // in the 256-color palette and mapping to the nearest entry.
- {
- int under_bg = (char_aep != NULL)
- ? char_aep->ae_u.cterm.bg_color : 0;
- guicolor_T under_bg_rgb = INVALCOLOR;
- guicolor_T popup_bg_rgb = INVALCOLOR;
+ new_en.ae_u.cterm.fg_color = blend_cterm_colors(
+ popup_aep->ae_u.cterm.fg_color, popup_bg_rgb,
+ under_fg, under_fg_rgb, fallback_fg_rgb, blend);
+ }
+ // Approximate cterm bg by blending with the underlying bg
+ // in the 256-color palette and mapping to the nearest entry.
+ {
+ int under_bg = (char_aep != NULL)
+ ? char_aep->ae_u.cterm.bg_color : 0;
+ guicolor_T under_bg_rgb = INVALCOLOR;
#ifdef FEAT_TERMGUICOLORS
- if (char_aep != NULL)
- under_bg_rgb = char_aep->ae_u.cterm.bg_rgb;
- popup_bg_rgb = popup_aep->ae_u.cterm.bg_rgb;
+ if (char_aep != NULL)
+ under_bg_rgb = char_aep->ae_u.cterm.bg_rgb;
#endif
- new_en.ae_u.cterm.bg_color = blend_cterm_colors(
- popup_aep->ae_u.cterm.bg_color, popup_bg_rgb,
- under_bg, under_bg_rgb, fallback_bg_rgb, blend);
- }
+ new_en.ae_u.cterm.bg_color = blend_cterm_colors(
+ popup_aep->ae_u.cterm.bg_color, popup_bg_rgb,
+ under_bg, under_bg_rgb, fallback_bg_rgb, blend);
+ }
#ifdef FEAT_TERMGUICOLORS
- // Blend fg_rgb: pum_bg toward underlying_fg.
- // CTERMCOLOR is a sentinel meaning "use the cterm color";
- // treat it as no underlying color so it is not blended in
- // as a real near-white pixel.
- if (popup_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
- {
- int base_fg = fallback_fg_rgb;
- if (char_aep != NULL
- && !COLOR_INVALID(char_aep->ae_u.cterm.fg_rgb))
- base_fg = char_aep->ae_u.cterm.fg_rgb;
- new_en.ae_u.cterm.fg_rgb = blend_colors(
- popup_aep->ae_u.cterm.bg_rgb, base_fg, blend);
- }
+ // Blend fg_rgb: pum_bg toward underlying_fg.
+ // Fall back to cterm color converted to RGB when
+ // gui color is not set.
+ // CTERMCOLOR is a sentinel meaning "use the cterm color";
+ // treat it as no underlying color so it is not blended in
+ // as a real near-white pixel.
+ if (popup_bg_rgb != INVALCOLOR)
+ {
+ int base_fg = fallback_fg_rgb;
+ if (char_aep != NULL
+ && !COLOR_INVALID(char_aep->ae_u.cterm.fg_rgb))
+ base_fg = char_aep->ae_u.cterm.fg_rgb;
+ new_en.ae_u.cterm.fg_rgb = blend_colors(
+ popup_bg_rgb, base_fg, blend);
+ }
+ if (popup_bg_rgb != INVALCOLOR)
+ {
// Blend bg_rgb.
- if (popup_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
- {
- guicolor_T underlying_bg = fallback_bg_rgb;
- if (char_aep != NULL
- && !COLOR_INVALID(char_aep->ae_u.cterm.bg_rgb))
- underlying_bg = char_aep->ae_u.cterm.bg_rgb;
- new_en.ae_u.cterm.bg_rgb = blend_colors(
- popup_aep->ae_u.cterm.bg_rgb,
- underlying_bg, blend);
- }
-#endif
+ guicolor_T underlying_bg = fallback_bg_rgb;
+ if (char_aep != NULL
+ && !COLOR_INVALID(char_aep->ae_u.cterm.bg_rgb))
+ underlying_bg = char_aep->ae_u.cterm.bg_rgb;
+ new_en.ae_u.cterm.bg_rgb = blend_colors(
+ popup_bg_rgb, underlying_bg, blend);
}
+#endif
}
return get_attr_entry(&cterm_attr_table, &new_en);
}
@@ -3829,6 +3874,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int blend UNUSED)
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
+
return get_attr_entry(&term_attr_table, &new_en);
}

diff --git a/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared.dump b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared.dump
new file mode 100644
index 000000000..5f58d621c
--- /dev/null
+++ b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared.dump
@@ -0,0 +1,20 @@
+|i+0&#ffffff0|t|e|m> @70
+|╭|─@15|╮| |X| |X| |X| |X| |X| @46
+|│| +0#0000001#ffffff255|i|t+0&#ff8787255|e|m| +0#0000000#ffffff0|Z+0#87ff87255#ffffff255@2| +0#0000000#ffffff0|X+0#818181255#ffffff255| +0#0000000#ffffff0|Y+0#818181255#ff8787255@2| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#0000001#ffffff255|a|n+0&#ff8787255|o|t|h+0&#ffffff255|e|r| |i|t|e|m+0&#ff8787255|Y+0#818181255&@1| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#0000001#ffffff255|a|n+0&#ff8787255|d| |a+0&#ffffff255| |l|a|s|t| |o+0&#ff8787255|n|e| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|╰|─@15|╯| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|5| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_2.dump b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_2.dump
new file mode 100644
index 000000000..76834fd6b
--- /dev/null
+++ b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_2.dump
@@ -0,0 +1,20 @@
+|i+0&#ffffff0|t|e|m> @70
+|╭|─@15|╮| |X| |X| |X| |X| |X| @46
+|│| +0#000000255#ffffff255|i|t+0&#ff8080255|e|m| +0#0000000#ffffff0|Z+0#80ff80255#ffffff255@2| +0#0000000#ffffff0|X+0#808080255#ffffff255| +0#0000000#ffffff0|Y+0#808080255#ff8080255@2| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#000000255#ffffff255|a|n+0&#ff8080255|o|t|h+0&#ffffff255|e|r| |i|t|e|m+0&#ff8080255|Y+0#808080255&@1| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#000000255#ffffff255|a|n+0&#ff8080255|d| |a+0&#ffffff255| |l|a|s|t| |o+0&#ff8080255|n|e| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|╰|─@15|╯| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+|~+0#0000ff255&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|5| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_3.dump b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_3.dump
new file mode 100644
index 000000000..8817b4e00
--- /dev/null
+++ b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_3.dump
@@ -0,0 +1,20 @@
+|i+0&#ffffff0|t|e|m> @70
+|╭|─@15|╮| |X| |X| |X| |X| |X| @46
+|│| +0#ffffff255#000000255|i|t+0&#7f0000255|e|m| +0#0000000#ffffff0|Z+0#007f00255#000000255@2| +0#0000000#ffffff0|X+0#7f7f7f255#000000255| +0#0000000#ffffff0|Y+0#7f7f7f255#7f0000255@2| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#ffffff255#000000255|a|n+0&#7f0000255|o|t|h+0&#000000255|e|r| |i|t|e|m+0&#7f0000255|Y+0#7f7f7f255&@1| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#ffffff255#000000255|a|n+0&#7f0000255|d| |a+0&#000000255| |l|a|s|t| |o+0&#7f0000255|n|e| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|╰|─@15|╯| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff0000255@2| +0&#ffffff0|Z+0#00ff00255&@2| +0#0000000&|X| |Y+0&#ff0000255@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+|~+0#0000ff255&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|5| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_4.dump b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_4.dump
new file mode 100644
index 000000000..64a2e631d
--- /dev/null
+++ b/src/testdir/dumps/Test_pumopt_opacity_pmenu_cleared_4.dump
@@ -0,0 +1,20 @@
+|i+0&#ffffff0|t|e|m> @70
+|╭|─@15|╮| |X| |X| |X| |X| |X| @46
+|│| +0#ffffff16#000000255|i|t+0&#870000255|e|m| +0#0000000#ffffff0|Z+0#008700255#000000255@2| +0#0000000#ffffff0|X+0#818181255#000000255| +0#0000000#ffffff0|Y+0#818181255#870000255@2| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#ffffff16#000000255|a|n+0&#870000255|o|t|h+0&#000000255|e|r| |i|t|e|m+0&#870000255|Y+0#818181255&@1| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|│| +0#ffffff16#000000255|a|n+0&#870000255|d| |a+0&#000000255| |l|a|s|t| |o+0&#870000255|n|e| +0#0000000#ffffff0|│| |X| |X| |X| |X| |X| @46
+|╰|─@15|╯| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+@1|X| |Y+0&#ff404010@2| +0&#ffffff0|Z+0#40ff4011&@2| +0#0000000&|X| |Y+0&#ff404010@2| +0&#ffffff0|X| |X| |X| |X| |X| |X| @46
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|5| @10|A|l@1|
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index ac394dd2b..e5d9094f7 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -2632,6 +2632,62 @@ func Test_popup_opacity_move_after_close()
call StopVimInTerminal(buf)
endfunc

+" Test pumopt opacity when Pmenu highlight groups are cleared
+func Test_pumopt_opacity_pmenu_cleared()
+ CheckScreendump
+ let lines =<< trim END
+ set pumopt=opacity:50,border:round
+ set completeopt=menu
+ highlight clear
+ highlight clear Pmenu
+ highlight clear PmenuSel
+ highlight Underbg ctermbg=red guibg=red
+ highlight Underfg ctermfg=green guifg=green
+ call setline(1, '')
+ for i in range(10)
+ call append(line('$'), ' X YYY ZZZ X YYY X X X X X X')
+ endfor
+ call matchadd('Underbg', 'YYY')
+ call matchadd('Underfg', 'ZZZ')
+ normal gg
+ inoremap <F5> <Cmd>call complete(col('.'),
+ \ ['item', 'another item', 'and a last one'])<CR>
+ END
+ call writefile(lines, 'Xpumopacitypmenucleared', 'D')
+ let buf = RunVimInTerminal('-S Xpumopacitypmenucleared', {})
+ call TermWait(buf)
+ " light background
+ call term_sendkeys(buf, "i\<F5>")
+ call TermWait(buf, 100)
+ call VerifyScreenDump(buf, 'Test_pumopt_opacity_pmenu_cleared', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>u")
+ call TermWait(buf)
+ " light termguicolors
+ call term_sendkeys(buf, ":set termguicolors\<CR>")
+ call term_sendkeys(buf, "i\<F5>")
+ call TermWait(buf, 100)
+ call VerifyScreenDump(buf, 'Test_pumopt_opacity_pmenu_cleared_2', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>u")
+ call TermWait(buf)
+ " dark termguicolors
+ call term_sendkeys(buf, ":set background=dark\<CR>")
+ call term_sendkeys(buf, ":highlight clear Pmenu\<CR>")
+ call term_sendkeys(buf, ":highlight clear PmenuSel\<CR>")
+ call term_sendkeys(buf, "i\<F5>")
+ call TermWait(buf, 100)
+ call VerifyScreenDump(buf, 'Test_pumopt_opacity_pmenu_cleared_3', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>u")
+ call TermWait(buf)
+ " dark background
+ call term_sendkeys(buf, ":set notermguicolors\<CR>")
+ call term_sendkeys(buf, "i\<F5>")
+ call TermWait(buf, 100)
+ call VerifyScreenDump(buf, 'Test_pumopt_opacity_pmenu_cleared_4', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>u")
+ call TermWait(buf)
+ 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/version.c b/src/version.c
index 4dc958e2a..25c38c40e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 758,
/**/
757,
/**/
Reply all
Reply to author
Forward
0 new messages