patch 9.2.0545: popup: blending uses hardcoded fallback colors

Commit: 
https://github.com/vim/vim/commit/7a027846bf819709d6636133e81e614a519497f2
Author: Shad <[email protected]>
Date:   Wed May 27 20:37:25 2026 +0000

    patch 9.2.0545: popup: blending uses hardcoded fallback colors
    
    Problem:  Popup with opacity fades to black regardless of the colorscheme
              or 'background' option.  With a light colorscheme (or the
              default with background=light), lower opacity values darken the
              popup and it no longer matches the Normal background.
    Solution: Compute fallback foreground and background colors from
              guifg/guibg, ctermfg/ctermbg, or deduce from the 'background' 
option,
              and use them in the popup blending paths instead of hardcoded
              white/black (Shad).
    
    closes: #20285
    
    Signed-off-by: Shad <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/globals.h b/src/globals.h
index 0a4a09d65..96d678545 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -853,6 +853,8 @@ EXTERN guicolor_T cterm_normal_fg_gui_color INIT(= 
INVALCOLOR);
 EXTERN guicolor_T cterm_normal_bg_gui_color INIT(= INVALCOLOR);
 EXTERN guicolor_T cterm_normal_ul_gui_color INIT(= INVALCOLOR);
 #endif
+EXTERN guicolor_T fallback_fg_rgb INIT(= INVALCOLOR); // RGB fallback 
foreground color from guifg, ctermfg or deduced from 'background'
+EXTERN guicolor_T fallback_bg_rgb INIT(= INVALCOLOR); // RGB fallback 
background color from guibg, ctermbg or deduced from 'background'
 #ifdef FEAT_TERMRESPONSE
 EXTERN int     is_mac_terminal INIT(= FALSE);  // recognized Terminal.app
 #endif
diff --git a/src/highlight.c b/src/highlight.c
index 2f92a2e52..7405aed32 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -533,6 +533,9 @@ highlight_link_id(int id)
 }
 #endif
 
+static void resolve_fallback_fg_to_rgb(void);
+static void resolve_fallback_bg_to_rgb(void);
+
     void
 init_highlight(
     int                both,       // include groups where 'bg' doesn't matter
@@ -616,6 +619,8 @@ init_highlight(
        }
     }
 #endif
+    resolve_fallback_fg_to_rgb();
+    resolve_fallback_bg_to_rgb();
 }
 
 #if defined(FEAT_EVAL) && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS))
@@ -1977,6 +1982,8 @@ do_highlight(
                redraw_all_later(UPD_NOT_VALID);
            }
 #endif
+           resolve_fallback_fg_to_rgb();
+           resolve_fallback_bg_to_rgb();
 #ifdef FEAT_VTP
            control_console_color_rgb();
 #endif
@@ -2091,6 +2098,8 @@ restore_cterm_colors(void)
     cterm_normal_bg_gui_color = INVALCOLOR;
     cterm_normal_ul_gui_color = INVALCOLOR;
 # endif
+    fallback_fg_rgb = INVALCOLOR;
+    fallback_bg_rgb = INVALCOLOR;
 #endif
 }
 
@@ -3259,6 +3268,53 @@ resolve_color_to_rgb(int cterm_c, guicolor_T rgb UNUSED, 
int *r, int *g, int *b)
     return false;
 }
 
+/*
+ * get a RGB fallback color from gui, cterm or default color
+ */
+    static guicolor_T
+resolve_fallback_color(int cterm_c, guicolor_T rgb, guicolor_T default_rgb)
+{
+    int red, green, blue;
+    if (!resolve_color_to_rgb(cterm_c, rgb, &red, &green, &blue))
+       return default_rgb;
+    else
+       return (red << 16) | (green << 8) | blue;
+}
+
+/*
+ * get a RGB fallback foreground color from guifg, ctermfg or deduced from 
background
+ */
+    static void
+resolve_fallback_fg_to_rgb(void)
+{
+    guicolor_T fgcolor_or_gui_fgcolor = INVALCOLOR;
+#ifdef FEAT_TERMGUICOLORS
+    fgcolor_or_gui_fgcolor = cterm_normal_fg_gui_color;
+#endif
+#ifdef FEAT_GUI
+    if (gui.in_use)
+       fgcolor_or_gui_fgcolor = gui.norm_pixel;
+#endif
+    fallback_fg_rgb = resolve_fallback_color(cterm_normal_fg_color, 
fgcolor_or_gui_fgcolor, (*p_bg == 'l') ? 0x000000 : 0xFFFFFF);
+}
+
+/*
+ * get a RGB fallback background color from guifg, ctermbg or deduced from 
background
+ */
+    static void
+resolve_fallback_bg_to_rgb(void)
+{
+    guicolor_T bgcolor_or_gui_bgcolor = INVALCOLOR;
+#ifdef FEAT_TERMGUICOLORS
+    bgcolor_or_gui_bgcolor = cterm_normal_bg_gui_color;
+#endif
+#ifdef FEAT_GUI
+    if (gui.in_use)
+       bgcolor_or_gui_bgcolor = gui.back_pixel;
+#endif
+    fallback_bg_rgb = resolve_fallback_color(cterm_normal_bg_color, 
bgcolor_or_gui_bgcolor, (*p_bg == 'l') ? 0xFFFFFF : 0x000000);
+}
+
 /*
  * Blend two colors expressed as (cterm 256 index, gui RGB) pairs and
  * return the nearest 1-based cterm 256-color index.  Prefers the gui
@@ -3325,14 +3381,7 @@ blend_colors(guicolor_T popup_color, guicolor_T 
bg_color, int blend_val)
     b1 = popup_color & 0xFF;
 
     if (COLOR_INVALID(bg_color))
-    {
-       // Background color unknown: fade popup color to black as blend 
increases
-       // This makes background text more visible at high blend values
-       r = r1 * (100 - blend_val) / 100;
-       g = g1 * (100 - blend_val) / 100;
-       b = b1 * (100 - blend_val) / 100;
-       return (r << 16) | (g << 8) | b;
-    }
+       bg_color = fallback_bg_rgb;
 
     r2 = (bg_color >> 16) & 0xFF;
     g2 = (bg_color >> 8) & 0xFF;
@@ -3392,7 +3441,7 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, 
int blend_fg UNUSED)
                    // blend_fg=TRUE: fade underlying text toward popup bg.
                    if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
                    {
-                       int base_fg = 0xFFFFFF;
+                       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;
@@ -3414,7 +3463,7 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, 
int blend_fg UNUSED)
                // Blend background color: blend popup bg toward underlying bg
                if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
                {
-                   guicolor_T underlying_bg = 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(
@@ -3489,7 +3538,7 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, 
int blend_fg UNUSED)
 #endif
                    new_en.ae_u.cterm.fg_color = blend_cterm_colors(
                            popup_aep->ae_u.cterm.bg_color, popup_bg_rgb,
-                           under_fg, under_fg_rgb, 0xFFFFFF, blend);
+                           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.
@@ -3505,7 +3554,7 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, 
int blend_fg UNUSED)
 #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, 0x000000, blend);
+                           under_bg, under_bg_rgb, fallback_bg_rgb, blend);
                }
 #ifdef FEAT_TERMGUICOLORS
                // Blend RGB colors for termguicolors mode.
@@ -3529,7 +3578,7 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, 
int blend_fg UNUSED)
                        // blend_fg=TRUE: fade underlying text toward popup bg.
                        if (popup_bg != INVALCOLOR)
                        {
-                           int base_fg = 0xFFFFFF;
+                           int base_fg = fallback_fg_rgb;
                            // 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.
@@ -3554,12 +3603,12 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, 
int blend_fg UNUSED)
                        else if (!COLOR_INVALID(cterm_normal_fg_gui_color))
                            new_en.ae_u.cterm.fg_rgb = 
cterm_normal_fg_gui_color;
                        else
-                           new_en.ae_u.cterm.fg_rgb = 0xFFFFFF;
+                           new_en.ae_u.cterm.fg_rgb = fallback_fg_rgb;
                    }
                    if (popup_bg != INVALCOLOR)
                    {
                        // Blend popup bg toward underlying bg
-                       guicolor_T underlying_bg = 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;
@@ -3626,7 +3675,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int 
blend UNUSED)
                // blend=100 (transparent): fg = underlying_fg (text visible)
                if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
                {
-                   int base_fg = 0xFFFFFF;
+                   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;
@@ -3636,7 +3685,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int 
blend UNUSED)
                // Blend bg: popup bg toward underlying bg.
                if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
                {
-                   guicolor_T underlying_bg = 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(
@@ -3685,7 +3734,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int 
blend UNUSED)
 #endif
                    new_en.ae_u.cterm.fg_color = blend_cterm_colors(
                            popup_aep->ae_u.cterm.bg_color, popup_bg_rgb,
-                           under_fg, under_fg_rgb, 0xFFFFFF, blend);
+                           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.
@@ -3701,7 +3750,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int 
blend UNUSED)
 #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, 0x000000, blend);
+                           under_bg, under_bg_rgb, fallback_bg_rgb, blend);
                }
 #ifdef FEAT_TERMGUICOLORS
                // Blend fg_rgb: pum_bg toward underlying_fg.
@@ -3710,7 +3759,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int 
blend UNUSED)
                // as a real near-white pixel.
                if (popup_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
                {
-                   int base_fg = 0xFFFFFF;
+                   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;
@@ -3720,7 +3769,7 @@ hl_pum_blend_attr(int char_attr, int popup_attr, int 
blend UNUSED)
                // Blend bg_rgb.
                if (popup_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
                {
-                   guicolor_T underlying_bg = 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;
diff --git a/src/testdir/dumps/Test_popup_opacity_move_after_close.dump 
b/src/testdir/dumps/Test_popup_opacity_move_after_close.dump
index 8988d85a1..9b1edba5a 100644
--- a/src/testdir/dumps/Test_popup_opacity_move_after_close.dump
+++ b/src/testdir/dumps/Test_popup_opacity_move_after_close.dump
@@ -1,8 +1,8 @@
 >a+0&#ffffff0|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y
 |z| @23
-|a|b|c|d|e|f|g|h|i|j|k|╔+0#0000001#875f87255|═@4|╗|s+0#0000000#ffffff0|t|u|v|w|x|y
-|z| @9|║+0#0000001#875f87255|A| +0#ffd7ff255&@3|║+0#0000001&| 
+0#0000000#ffffff0@6
-|a|b|c|d|e|f|g|h|i|j|k|╚+0#0000001#875f87255|═@4|╝|s+0#0000000#ffffff0|t|u|v|w|x|y
+|a|b|c|d|e|f|g|h|i|j|k|╔+0#0000001#ffd7ff255|═@4|╗|s+0#0000000#ffffff0|t|u|v|w|x|y
+|z| @9|║+0#0000001#ffd7ff255|A| +0#875f87255&@3|║+0#0000001&| 
+0#0000000#ffffff0@6
+|a|b|c|d|e|f|g|h|i|j|k|╚+0#0000001#ffd7ff255|═@4|╝|s+0#0000000#ffffff0|t|u|v|w|x|y
 |z| @23
 |@+0#4040ff13&@2| @21
 | +0#0000000&@12|1|,|1| @4|T|o|p| 
diff --git a/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_1.dump 
b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_1.dump
new file mode 100644
index 000000000..120ab9615
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_1.dump
@@ -0,0 +1,12 @@
+>X+0&#ffffff0| @2|X| @2|X| @2|X| @2|X| @42
+|X| |P+0#ffffff16#5f5fff255|o|p|u|p| +0#000087255&|X| @2|X+0#0000000#ffffff0| 
@2|X| @42
+|X| | +0#000087255#5f5fff255@1|X| @2|X| @2|X+0#0000000#ffffff0| @2|X| @42
+|X| @2|X| @2|X| @2|X| @2|X| @42
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_2.dump 
b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_2.dump
new file mode 100644
index 000000000..c14b46ac4
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_2.dump
@@ -0,0 +1,12 @@
+>X+0&#ffffff0| @2|X| @2|X| @2|X| @2|X| @42
+|X| |P+0#ffffff16#000087255|o|p|u|p| +0#5f5fff255&|X| @2|X+0#0000000#ffffff0| 
@2|X| @42
+|X| | +0#5f5fff255#000087255@1|X| @2|X| @2|X+0#0000000#ffffff0| @2|X| @42
+|X| @2|X| @2|X| @2|X| @2|X| @42
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_3.dump 
b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_3.dump
new file mode 100644
index 000000000..bb9e359c8
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_3.dump
@@ -0,0 +1,12 @@
+>X+0#000000255#ffd7af255| @2|X| @2|X| @2|X| @2|X| @42
+|X| |P+0&#5f5fd7255|o|p|u|p| +0#000087255&|X| @2|X+0#000000255#ffd7af255| 
@2|X| @42
+|X| | +0#000087255#5f5fd7255@1|X| @2|X| @2|X+0#000000255#ffd7af255| @2|X| @42
+|X| @2|X| @2|X| @2|X| @2|X| @42
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#000000255&@41|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_4.dump 
b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_4.dump
new file mode 100644
index 000000000..c9f7d70df
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_opacity_fade_to_background_4.dump
@@ -0,0 +1,12 @@
+>X+0#000000255#ffdab9255| @2|X| @2|X| @2|X| @2|X| @42
+|X| |P+0&#6657e3255|o|p|u|p| +0#000099255&|X| @2|X+0#000000255#ffdab9255| 
@2|X| @42
+|X| | +0#000099255#6657e3255@1|X| @2|X| @2|X+0#000000255#ffdab9255| @2|X| @42
+|X| @2|X| @2|X| @2|X| @2|X| @42
+|~+0#0000ff255&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#000000255&@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 d197c8dac..932ebb724 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#5fafd7255|o@1| +0#87d7ff255&@1|b+0#ffffff16&|a|r| 
+0#0000000#ffffff0@57
-|4| @7|b+0#ffffff16#5fafd7255|a|z| +0#87d7ff255&@4| +0#0000000#ffffff0@57
+|3| @7|f+0#ff404010#87d7ff255|o@1| +0#5fafd7255&@1|b+0#ffffff16&|a|r| 
+0#0000000#ffffff0@57
+|4| @7|b+0#ffffff16#87d7ff255|a|z| +0#5fafd7255&@4| +0#0000000#ffffff0@57
 |5| @73
 |6| @73
 |7| @73
diff --git a/src/testdir/dumps/Test_popupwin_opacity_textprop_undercurl.dump 
b/src/testdir/dumps/Test_popupwin_opacity_textprop_undercurl.dump
index 489b0dbbc..434f04cd8 100644
--- a/src/testdir/dumps/Test_popupwin_opacity_textprop_undercurl.dump
+++ b/src/testdir/dumps/Test_popupwin_opacity_textprop_undercurl.dump
@@ -1,6 +1,6 @@
->a+0&#ffffff0@2| |b@2| 
|c|P+0#e5e9f0255#03050b255|O|P|U|P|d+0#a9abb1255&|C+0#e5e9f0255&|O|N|T|E|N|T|f+0#a9abb1255&|
 |g@2| |h@2| @7| +0#0000000#ffffff0@10
-|i@2| |j@2| |k|k+0#a9abb1255#03050b255@1| |l@2| |m@2| |n@2| |o@2| |p@2| @7| 
+0#0000000#ffffff0@10
-|q@2| |r@2| |s|s+0#a9abb1255#03050b255@1| 
|m+0#e5e9f0255&|i|d@1|l|e|u+0#a9abb1255&| |v@2| |w@2| |x@2| @7| 
+0#0000000#ffffff0@10
+>a+0&#ffffff0@2| |b@2| 
|c|P+0#e5e9f0255#a9abb1255|O|P|U|P|d+0#04060c255&|C+0#e5e9f0255&|O|N|T|E|N|T|f+0#04060c255&|
 |g@2| |h@2| @7| +0#0000000#ffffff0@10
+|i@2| |j@2| |k|k+0#04060c255#a9abb1255@1| |l@2| |m@2| |n@2| |o@2| |p@2| @7| 
+0#0000000#ffffff0@10
+|q@2| |r@2| |s|s+0#04060c255#a9abb1255@1| 
|m+0#e5e9f0255&|i|d@1|l|e|u+0#04060c255&| |v@2| |w@2| |x@2| @7| 
+0#0000000#ffffff0@10
 |y@2| |z@2| |1@2| |2@2| |3@2| |4@2| |5@2| |6@2| @18
 |~+0#0000ff255&| @48
 |~| @48
diff --git a/src/testdir/dumps/Test_popupwin_opacity_vsplit_1.dump 
b/src/testdir/dumps/Test_popupwin_opacity_vsplit_1.dump
index d6179c249..594b3bfe4 100644
--- a/src/testdir/dumps/Test_popupwin_opacity_vsplit_1.dump
+++ b/src/testdir/dumps/Test_popupwin_opacity_vsplit_1.dump
@@ -1,6 +1,6 @@
 >r+0&#ffffff0|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| 
 >@2||+1&&|l+0&&|e|f|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
 |r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
-|r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| 
|o+0#ffffff255#000045255|p|a|c|i|t|y|x+0#7f7fc5255&|o+0#ffffff255&|v|e|r||+1#7f7fc5255&|v+0#ffffff255&|s|p|l|i|t|i+0#7f7fc5255&|n|d|o|w|
 |t+0#0000000#ffffff0|e|x|t| |h|e|r|e| |x@3| @2
+|r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| 
|o+0#ffffff255#7f7fc5255|p|a|c|i|t|y|x+0#000046255&|o+0#ffffff255&|v|e|r||+1#000046255&|v+0#ffffff255&|s|p|l|i|t|i+0#000046255&|n|d|o|w|
 |t+0#0000000#ffffff0|e|x|t| |h|e|r|e| |x@3| @2
 |r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
 |r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
 |r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
diff --git a/src/testdir/dumps/Test_popupwin_opacity_vsplit_2.dump 
b/src/testdir/dumps/Test_popupwin_opacity_vsplit_2.dump
index 3fa171461..52a4b95d2 100644
--- a/src/testdir/dumps/Test_popupwin_opacity_vsplit_2.dump
+++ b/src/testdir/dumps/Test_popupwin_opacity_vsplit_2.dump
@@ -1,6 +1,6 @@
 |r+0&#ffffff0|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| 
@2||+1&&|l+0&&|e|f|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
 |r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
-|r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| 
|o+0#ffffff255#000045255|p|a|c|i|t|y|x+0#7f7fc5255&|o+0#ffffff255&|v|e|r||+1#7f7fc5255&|v+0#ffffff255&|s|p|l|i|t|i+0#7f7fc5255&|n|d|o|w|
 |t+0#0000000#ffffff0|e|x|t| |h|e|r|e| |x@3| @2
+|r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| 
|o+0#ffffff255#7f7fc5255|p|a|c|i|t|y|x+0#000046255&|o+0#ffffff255&|v|e|r||+1#000046255&|v+0#ffffff255&|s|p|l|i|t|i+0#000046255&|n|d|o|w|
 |t+0#0000000#ffffff0|e|x|t| |h|e|r|e| |x@3| @2
 |r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
 |r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
 >r|i|g|h|t| |w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2||+1&&|l+0&&|e|f|t| 
 >|w|i|n|d|o|w| |t|e|x|t| |h|e|r|e| |x@3| @2
diff --git a/src/testdir/dumps/Test_popupwin_opacity_wide_1.dump 
b/src/testdir/dumps/Test_popupwin_opacity_wide_1.dump
index c712253f4..3a1112ed4 100644
--- a/src/testdir/dumps/Test_popupwin_opacity_wide_1.dump
+++ b/src/testdir/dumps/Test_popupwin_opacity_wide_1.dump
@@ -1,10 +1,10 @@
->い*0&#ffffff0|え*0#df7f7f255#600000255|ー@6| +&| +0#0000000#ffffff0|ー*&@7|い|!+&| 
|1| @3
-|い*&| +0#df7f7f255#600000255|カ*0#ffffff255&|ラ|フ|ル|な| +0#df7f7f255&|ー*&@1| +&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |2| @3
-|い*&| 
+0#df7f7f255#600000255|ポ*0#ffffff255#600030255|ッ|プ|ア|ッ|プ|で|─+0#df7f7f255&|╮| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |3| @3
-|い*&| +0#df7f7f255#600000255|最*0#ffffff255#600030255|上|川| 
+0#df7f7f255&|ぼ*&|赤|い|な|│+&| +0#0000000#ffffff0|ー*&@7|い|!+&| |4| @3
-|い*&| 
+0#df7f7f255#600000255|│+0&#600030255|あ*&|い|う|え|お|ー*0#a03f6f255&@1|│+0#df7f7f255&|
 +0#0000000#ffffff0|ー*&@7|い|!+&| |5| @3
-|い*&| +&|│+0#ffffff255#000060255|ー*0#7f7fdf255&@6|│+0#ffffff255&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |6| @3
-|い*&| +&|╰+0#ffffff255#000060255|─@13|╯| +0#0000000#ffffff0|ー*&@7|い|!+&| |7| @3
+>い*0&#ffffff0|え*0#600000255#df7f7f255|ー@6| +&| +0#0000000#ffffff0|ー*&@7|い|!+&| 
|1| @3
+|い*&| +0#600000255#df7f7f255|カ*0#ffffff255&|ラ|フ|ル|な| +0#600000255&|ー*&@1| +&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |2| @3
+|い*&| 
+0#600000255#df7f7f255|ポ*0#ffffff255#a03f6f255|ッ|プ|ア|ッ|プ|で|─+0#df7f7f255&|╮| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |3| @3
+|い*&| +0#600000255#df7f7f255|最*0#ffffff255#a03f6f255|上|川| 
+0#df7f7f255&|ぼ*&|赤|い|な|│+&| +0#0000000#ffffff0|ー*&@7|い|!+&| |4| @3
+|い*&| 
+0#600000255#df7f7f255|│+0#df7f7f255#a03f6f255|あ*&|い|う|え|お|ー*0#600030255&@1|│+0#df7f7f255&|
 +0#0000000#ffffff0|ー*&@7|い|!+&| |5| @3
+|い*&| +&|│+0#ffffff255#7f7fdf255|ー*0#000060255&@6|│+0#ffffff255&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |6| @3
+|い*&| +&|╰+0#ffffff255#7f7fdf255|─@13|╯| +0#0000000#ffffff0|ー*&@7|い|!+&| |7| @3
 |い*&|え|ー@15|い|!+&| |8| @3
 |い*&|え|ー@15|い|!+&| |9| @3
 |い*&|え|ー@15|い|!+&| |1|0| @2
diff --git a/src/testdir/dumps/Test_popupwin_opacity_wide_2.dump 
b/src/testdir/dumps/Test_popupwin_opacity_wide_2.dump
index 40c5dca85..491020186 100644
--- a/src/testdir/dumps/Test_popupwin_opacity_wide_2.dump
+++ b/src/testdir/dumps/Test_popupwin_opacity_wide_2.dump
@@ -1,13 +1,13 @@
 >い*0&#ffffff0|え|ー@15|い|!+&| |1| @3
 |い*&|え|ー@15|い|!+&| |2| @3
-|い*&| +&|╭+0#ffffff255#000060255|─@13|╮| +0#0000000#ffffff0|ー*&@7|い|!+&| |3| @3
-|い*&| +&|│+0#ffffff255#000060255|あ*&|め|ん|ぼ|赤|い|な|│+&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |4| @3
-|い*&| +&|│+0#ffffff255#000060255|あ*&|い|う|え|お|ー*0#7f7fdf255&@1|│+0#ffffff255&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |5| @3
-|い*&| +&|│+0#ffffff255#000060255|ー*0#7f7fdf255&@4| +&| 
+0#a03f6f255#600030255|ー*&|│+0#df7f7f255&| 
+0&#600000255|ー*&@5|ー*0#0000000#ffffff0@1|い|!+&| |6| @3
-|い*&| 
+&|╰+0#ffffff255#000060255|─@10|─+0#df7f7f255#600030255|カ*0#ffffff255&|ラ*0&#600000255|フ|ル|な|ー*0#df7f7f255&@2|ー*0#0000000#ffffff0@1|い|!+&|
 |7| @3
-|い*&|え|ー@4| +&| 
+0#df7f7f255#600000255|ポ*0#ffffff255&|ッ|プ|ア|ッ|プ|で|ー*0#df7f7f255&|ー*0#0000000#ffffff0@1|い|!+&|
 |8| @3
-|い*&|え|ー@4| +&| 
+0#df7f7f255#600000255|最*0#ffffff255&|上|川|ー*0#df7f7f255&@4|ー*0#0000000#ffffff0@1|い|!+&|
 |9| @3
-|い*&|え|ー@4| +&| +0#df7f7f255#600000255|ー*&@7|ー*0#0000000#ffffff0@1|い|!+&| 
|1|0| @2
+|い*&| +&|╭+0#ffffff255#7f7fdf255|─@13|╮| +0#0000000#ffffff0|ー*&@7|い|!+&| |3| @3
+|い*&| +&|│+0#ffffff255#7f7fdf255|あ*&|め|ん|ぼ|赤|い|な|│+&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |4| @3
+|い*&| +&|│+0#ffffff255#7f7fdf255|あ*&|い|う|え|お|ー*0#000060255&@1|│+0#ffffff255&| 
+0#0000000#ffffff0|ー*&@7|い|!+&| |5| @3
+|い*&| +&|│+0#ffffff255#7f7fdf255|ー*0#000060255&@4| +&| 
+0#600030255#a03f6f255|ー*&|│+0#df7f7f255&| 
+0#600000255#df7f7f255|ー*&@5|ー*0#0000000#ffffff0@1|い|!+&| |6| @3
+|い*&| 
+&|╰+0#ffffff255#7f7fdf255|─@10|─+0#df7f7f255#a03f6f255|カ*0#ffffff255&|ラ*0&#df7f7f255|フ|ル|な|ー*0#600000255&@2|ー*0#0000000#ffffff0@1|い|!+&|
 |7| @3
+|い*&|え|ー@4| +&| 
+0#600000255#df7f7f255|ポ*0#ffffff255&|ッ|プ|ア|ッ|プ|で|ー*0#600000255&|ー*0#0000000#ffffff0@1|い|!+&|
 |8| @3
+|い*&|え|ー@4| +&| 
+0#600000255#df7f7f255|最*0#ffffff255&|上|川|ー*0#600000255&@4|ー*0#0000000#ffffff0@1|い|!+&|
 |9| @3
+|い*&|え|ー@4| +&| +0#600000255#df7f7f255|ー*&@7|ー*0#0000000#ffffff0@1|い|!+&| 
|1|0| @2
 |い*&|え|ー@15|い|!+&| |1@1| @2
 |い*&|え|ー@15|い|!+&| |1|2| @2
 |い*&|え|ー@15|い|!+&| |1|3| @2
diff --git a/src/testdir/dumps/Test_popupwin_opacity_zero_01.dump 
b/src/testdir/dumps/Test_popupwin_opacity_zero_01.dump
index 1209af25c..8028c98c2 100644
--- a/src/testdir/dumps/Test_popupwin_opacity_zero_01.dump
+++ b/src/testdir/dumps/Test_popupwin_opacity_zero_01.dump
@@ -1,7 +1,7 @@
 >b+0&#ffffff0|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
-|b|a|c|k|b+0#ffffff16#00005f255|l|u|e|n+0#8787d7255&|p+0#ffffff16&|o|p|u|p|t+0#0000000#ffffff0|
 |h|e|r|e| @54
-|b|a|c|k|g|r|o|r+0#ffffff16#000000255|e|d| 
+0#0000000#ffffff0|p+0#ffffff16#000000255|o|p|u|p|h+0#0000000#ffffff0|e|r|e| @54
+|b|a|c|k|b+0#ffffff16#8787d7255|l|u|e|n+0#00005f255&|p+0#ffffff16&|o|p|u|p|t+0#0000000#ffffff0|
 |h|e|r|e| @54
+|b|a|c|k|g|r|o|r+0#ffffff16#ffffff255|e|d| 
+0#0000000#ffffff0|p+0#ffffff16#ffffff255|o|p|u|p|h+0#0000000#ffffff0|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
diff --git a/src/testdir/dumps/Test_popupwin_opacity_zero_02.dump 
b/src/testdir/dumps/Test_popupwin_opacity_zero_02.dump
index c724edb7f..d09818da5 100644
--- a/src/testdir/dumps/Test_popupwin_opacity_zero_02.dump
+++ b/src/testdir/dumps/Test_popupwin_opacity_zero_02.dump
@@ -1,7 +1,7 @@
 >b+0&#ffffff0|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
-|b|a|c|k|b+0#ffffff16#00005f255|l|u|e|n+0#8787d7255&|p+0#ffffff16&|o|p|u|p|t+0#0000000#ffffff0|
 |h|e|r|e| @54
-|b|a|c|k|g|r|o|r+0#ffffff16#000000255|e|d| 
+0#0000000#ffffff0|p+0#ffffff16#000000255|o|p|u|p|h+0#0000000#ffffff0|e|r|e| @54
+|b|a|c|k|b+0#ffffff16#8787d7255|l|u|e|n+0#00005f255&|p+0#ffffff16&|o|p|u|p|t+0#0000000#ffffff0|
 |h|e|r|e| @54
+|b|a|c|k|g|r|o|r+0#ffffff16#ffffff255|e|d| 
+0#0000000#ffffff0|p+0#ffffff16#ffffff255|o|p|u|p|h+0#0000000#ffffff0|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
 |b|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
diff --git a/src/testdir/dumps/Test_pumopt_opacity_50.dump 
b/src/testdir/dumps/Test_pumopt_opacity_50.dump
index 4490b1ef1..32e366ab3 100644
--- a/src/testdir/dumps/Test_pumopt_opacity_50.dump
+++ b/src/testdir/dumps/Test_pumopt_opacity_50.dump
@@ -13,8 +13,8 @@
 
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
 |R|O|U|N|D| @69
 |h|e|l@1|o> @69
-|h+0#0000001#5f5f5f255|e|l@1|o| +0#5f5fd7255&@9| +0#4040ff13#ffffff0@59
-|h+0#0000001#875f87255|e|l|p| +0#875fff255&@10| +0#4040ff13#ffffff0@59
+|h+0#0000001#dadada255|e|l@1|o| +0#5f5fd7255&@9| +0#4040ff13#ffffff0@59
+|h+0#0000001#ffd7ff255|e|l|p| +0#875fff255&@10| +0#4040ff13#ffffff0@59
 |~| @73
 |~| @73
 |-+2#0000000&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| 
|m+0#00e0003&|a|t|c|h| |1| |o|f| |2| +0#0000000&@33
diff --git a/src/testdir/dumps/Test_pumopt_opacity_text_attrs.dump 
b/src/testdir/dumps/Test_pumopt_opacity_text_attrs.dump
index 0911a881c..1ae8db5a1 100644
--- a/src/testdir/dumps/Test_pumopt_opacity_text_attrs.dump
+++ b/src/testdir/dumps/Test_pumopt_opacity_text_attrs.dump
@@ -1,7 +1,7 @@
 |ほ*0&#ffffff0|げ> +&@70
-|ほ*0#0000001#875f00255|げ|ほ*0#ffd787255&|げ|ほ|げ|漢*4#ff875f255&| +&| 
+4#e000e06#ffffff0|テ*&|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
-|ふ*0#ffffff16#00005f255|が|漢|字|ほ*0#87afaf255&|げ|漢*4#875faf255&| +&| 
+4#e000e06#ffffff0|テ*&|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
-|カ*0#ffffff16#00005f255|タ|カ|ナ|候|補|漢*4#875faf255&| +&| 
+4#e000e06#ffffff0|テ*&|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
+|ほ*0#0000001#ffd787255|げ|ほ*0#875f00255&|げ|ほ|げ|漢*4#ff875f255&| +&| 
+4#e000e06#ffffff0|テ*&|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
+|ふ*0#ffffff16#87afaf255|が|漢|字|ほ*0#00005f255&|げ|漢*4#875faf255&| +&| 
+4#e000e06#ffffff0|テ*&|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
+|カ*0#ffffff16#87afaf255|タ|カ|ナ|候|補|漢*4#875faf255&| +&| 
+4#e000e06#ffffff0|テ*&|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
 |ほ*&|げ|ほ|げ|ほ|げ|漢*4#e000e06&|字|テ|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
 |ほ*&|げ|ほ|げ|ほ|げ|漢*4#e000e06&|字|テ|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
 |ほ*&|げ|ほ|げ|ほ|げ|漢*4#e000e06&|字|テ|ス|ト|あ*0#0000000&|い|う|え|お|カ|タ|カ|ナ| +&@34
diff --git a/src/testdir/dumps/Test_pumopt_opacity_textprop_undercurl.dump 
b/src/testdir/dumps/Test_pumopt_opacity_textprop_undercurl.dump
index 8b9b0a091..a1242fde8 100644
--- a/src/testdir/dumps/Test_pumopt_opacity_textprop_undercurl.dump
+++ b/src/testdir/dumps/Test_pumopt_opacity_textprop_undercurl.dump
@@ -1,7 +1,7 @@
 |p+0&#ffffff0|o|p|u|p|-|i|t|e|m|-|1> @62
-|p+0#000000255#5f5f5f255|o|p|u|p|-|i|t|e|m|-|1|d+0#dedede255&@2| 
+0#0000000#ffffff0|e@2| |f@2| |g@2| |h@2| @43
-|p+0#000000255#7f457f255|o|p|u|p|-|i|t|e|m|-|2|d+0#ffc5ff255&@2| 
+0#0000000#ffffff0|e@2| |f@2| |g@2| |h@2| @43
-|p+0#000000255#7f457f255|o|p|u|p|-|i|t|e|m|-|3|d+0#ffc5ff255&@2| 
+0#0000000#ffffff0|e@2| |f@2| |g@2| |h@2| @43
+|p+0#000000255#dedede255|o|p|u|p|-|i|t|e|m|-|1|d+0#5f5f5f255&@2| 
+0#0000000#ffffff0|e@2| |f@2| |g@2| |h@2| @43
+|p+0#000000255#ffc5ff255|o|p|u|p|-|i|t|e|m|-|2|d+0#804680255&@2| 
+0#0000000#ffffff0|e@2| |f@2| |g@2| |h@2| @43
+|p+0#000000255#ffc5ff255|o|p|u|p|-|i|t|e|m|-|3|d+0#804680255&@2| 
+0#0000000#ffffff0|e@2| |f@2| |g@2| |h@2| @43
 |a@2| |b@2| |c@2| |d@2| |e@2| |f@2| |g@2| |h@2| @43
 |a@2| |b@2| |c@2| |d@2| |e@2| |f@2| |g@2| |h@2| @43
 |a@2| |b@2| |c@2| |d@2| |e@2| |f@2| |g@2| |h@2| @43
diff --git a/src/testdir/dumps/Test_pumopt_opacity_wide_bg.dump 
b/src/testdir/dumps/Test_pumopt_opacity_wide_bg.dump
index 87c7bd671..6b9bb9935 100644
--- a/src/testdir/dumps/Test_pumopt_opacity_wide_bg.dump
+++ b/src/testdir/dumps/Test_pumopt_opacity_wide_bg.dump
@@ -1,8 +1,8 @@
 |ほ*0&#ffffff0|げ> +&@70
 |╭+0#0000001#ffd7ff255|─@15|╮|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
-|│+0#0000001#ffd7ff255| +0&#5f5f5f255|ほ*&|げ|げ*0#dadada255&|ほ|げ|漢|字| 
+&|│+0#0000001#ffd7ff255|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
-|│+0#0000001#ffd7ff255| +0&#875f87255|ふ*&|が|漢|字|げ*0#ffd7ff255&|漢|字| 
+&|│+0#0000001#ffd7ff255|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
-|│+0#0000001#ffd7ff255| +0&#875f87255|カ*&|タ|カ|ナ|候|補|字*0#ffd7ff255&| 
+&|│+0#0000001#ffd7ff255|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
+|│+0#0000001#ffd7ff255| +0&#dadada255|ほ*&|げ|げ*0#5f5f5f255&|ほ|げ|漢|字| 
+&|│+0#0000001#ffd7ff255|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
+|│+0#0000001#ffd7ff255| |ふ*&|が|漢|字|げ*0#875f87255&|漢|字| 
+&|│+0#0000001&|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
+|│+0#0000001#ffd7ff255| |カ*&|タ|カ|ナ|候|補|字*0#875f87255&| 
+&|│+0#0000001&|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
 |╰+0#0000001#ffd7ff255|─@15|╯|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
 |ほ*&|げ|ほ|げ|ほ|げ|漢|字|テ|ス|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
 |ほ*&|げ|ほ|げ|ほ|げ|漢|字|テ|ス|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
diff --git a/src/testdir/dumps/Test_pumopt_opacity_wide_bg_shifted.dump 
b/src/testdir/dumps/Test_pumopt_opacity_wide_bg_shifted.dump
index ef1b9acf8..f67556307 100644
--- a/src/testdir/dumps/Test_pumopt_opacity_wide_bg_shifted.dump
+++ b/src/testdir/dumps/Test_pumopt_opacity_wide_bg_shifted.dump
@@ -1,8 +1,8 @@
 |ほ*0&#ffffff0|げ> +&@70
 |╭+0#0000001#ffd7ff255|─@15|╮|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
-|│+0#0000001#ffd7ff255| +0&#5f5f5f255|ほ*&|げ| 
+0#dadada255&|げ*&|ほ|げ|漢|字|│+0#0000001#ffd7ff255| 
+0#0000000#ffffff0|ス*&|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@33
-|│+0#0000001#ffd7ff255| +0&#875f87255|ふ*&|が|漢|字|げ*0#ffd7ff255&|漢|字| 
+&|│+0#0000001#ffd7ff255|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
-|│+0#0000001#ffd7ff255| +0&#875f87255|カ*&|タ|カ|ナ|候|補| 
+0#ffd7ff255&|字*&|│+0#0000001#ffd7ff255| 
+0#0000000#ffffff0|ス*&|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@33
+|│+0#0000001#ffd7ff255| +0&#dadada255|ほ*&|げ| 
+0#5f5f5f255&|げ*&|ほ|げ|漢|字|│+0#0000001#ffd7ff255| 
+0#0000000#ffffff0|ス*&|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@33
+|│+0#0000001#ffd7ff255| |ふ*&|が|漢|字|げ*0#875f87255&|漢|字| 
+&|│+0#0000001&|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
+|│+0#0000001#ffd7ff255| |カ*&|タ|カ|ナ|候|補| +0#875f87255&|字*&|│+0#0000001&| 
+0#0000000#ffffff0|ス*&|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@33
 |╰+0#0000001#ffd7ff255|─@15|╯|ス*0#0000000#ffffff0|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
 |a|ほ*&|げ|ほ|げ|ほ|げ|漢|字|テ|ス|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@33
 |ほ*&|げ|ほ|げ|ほ|げ|漢|字|テ|ス|ト|あ|い|う|え|お|カ|タ|カ|ナ| +&@34
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 783138b7e..11e431246 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -5482,4 +5482,43 @@ func Test_popupwin_close_copen_redraw()
   delfunc s:PopupFilter
 endfunc
 
+func Test_popup_opacity_fade_to_background()
+  CheckScreendump
+
+  " Opacity popup spanning a vertical split should redraw both windows
+  " underneath, not just the left one (blend accumulation bug).
+  let lines =<< trim END
+    call setline(1, repeat(['X   X   X   X   X'], 4))
+    hi PopupColor guibg=blue
+    let g:pop_id = popup_create(['Popup'], #{
+        \ line: 2, col: 3,
+        \ minwidth: 10,
+        \ minheight: 2,
+        \ highlight: 'PopupColor',
+        \ opacity: 60,
+        \ zindex: 50,
+        \})
+  END
+  call writefile(lines, 'XtestPopupOpacityFadeToBackground', 'D')
+  let buf = RunVimInTerminal('-S XtestPopupOpacityFadeToBackground', #{rows: 
12, cols: 60})
+  " light background without Normal color set
+  call VerifyScreenDump(buf, 'Test_popupwin_opacity_fade_to_background_1', {})
+
+  " dark background without Normal color set
+  call term_sendkeys(buf, ":set background=dark\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_opacity_fade_to_background_2', {})
+
+  " light background with Normal cterm color set
+  call term_sendkeys(buf, ":set background=light\<CR>")
+  call term_sendkeys(buf, ":highlight Normal ctermfg=16 ctermbg=223\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_opacity_fade_to_background_3', {})
+
+  " light background with Normal gui color set
+  call term_sendkeys(buf, ":set termguicolors\<CR>")
+  call term_sendkeys(buf, ":highlight Normal ctermfg=NONE ctermbg=NONE 
guifg=#000000 guibg=#ffdab9\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_opacity_fade_to_background_4', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2
diff --git a/src/version.c b/src/version.c
index 80f6a620b..4c0899871 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    545,
 /**/
     544,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wSLMD-009m1u-Md%40256bit.org.

Raspunde prin e-mail lui