patch 9.2.0064: popup: opacity feature causes flickering

Commit: 
https://github.com/vim/vim/commit/97c5bed84b5a0b5a861007e23aaccfc76c519b34
Author: Hirohito Higashi <[email protected]>
Date:   Thu Feb 26 20:49:06 2026 +0000

    patch 9.2.0064: popup: opacity feature causes flickering
    
    Problem:  popup: opacity feature causes flickering
              (after v9.2.0016)
    Solution: Only skip the mask and enable the opacity context if
              w_popup_blend is greater than 0 (Hirohito Higashi).
    
    fixes:  #19510
    fixes:  #19499
    closes: #19515
    
    Signed-off-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/popupwin.c b/src/popupwin.c
index e7ab2687e..267ffb6ff 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -4128,9 +4128,10 @@ may_update_popup_mask(int type)
        height = popup_height(wp);
        popup_update_mask(wp, width, height);
 
-       // Popup with opacitys do not block lower layers from drawing,
-       // so they don't participate in the popup_mask.
-       if (wp->w_popup_flags & POPF_OPACITY)
+       // Popup with partial transparency do not block lower layers from
+       // drawing, so they don't participate in the popup_mask.
+       // Fully opaque popups (blend == 0) still block lower layers.
+       if ((wp->w_popup_flags & POPF_OPACITY) && wp->w_popup_blend > 0)
            continue;
 
        for (line = wp->w_winrow;
@@ -4343,7 +4344,8 @@ update_popups(void (*win_update)(win_T *wp))
        screen_zindex = wp->w_zindex;
 
        // Set popup with opacity context for screen drawing.
-       if (wp->w_popup_flags & POPF_OPACITY)
+       // Only enable transparency rendering when blend > 0 (not fully opaque).
+       if ((wp->w_popup_flags & POPF_OPACITY) && wp->w_popup_blend > 0)
            screen_opacity_popup = wp;
        else
            screen_opacity_popup = NULL;
diff --git a/src/testdir/dumps/Test_popupwin_opacity_100_blocks_bg.dump 
b/src/testdir/dumps/Test_popupwin_opacity_100_blocks_bg.dump
new file mode 100644
index 000000000..362259bde
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_opacity_100_blocks_bg.dump
@@ -0,0 +1,10 @@
+>b+0&#ffffff0|a|c|k|g|r|o|u|n|d| |t|e|x|t| |h|e|r|e| @54
+|P+0#0000001#ffd7ff255|O|P|U|P| |L|I|N|E| |1| @7| +0#0000000#ffffff0@54
+|P+0#0000001#ffd7ff255|O|P|U|P| |L|I|N|E| |2| @7| +0#0000000#ffffff0@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
+|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
+@57|1|,|1| @10|T|o|p| 
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 24d8fab57..4c41bf75d 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -4813,6 +4813,23 @@ func Test_popup_opacity_highlight()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_popup_opacity_100_blocks_background()
+  CheckScreendump
+
+  " opacity:100 (fully opaque, blend==0) popup should block background content.
+  " Before the fix, POPF_OPACITY caused the popup to be excluded from
+  " popup_mask even with blend==0, making background show through.
+  let lines =<< trim END
+    call setline(1, repeat(['background text here'], 10))
+    call popup_create(['POPUP LINE 1', 'POPUP LINE 2'],
+        \ #{line: 2, col: 1, minwidth: 20, opacity: 100})
+  END
+  call writefile(lines, 'XtestPopupOpaque100', 'D')
+  let buf = RunVimInTerminal('-S XtestPopupOpaque100', #{rows: 10})
+  call VerifyScreenDump(buf, 'Test_popupwin_opacity_100_blocks_bg', {})
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_popup_getwininfo_tabnr()
   tab split
   let winid1 = popup_create('sup', #{tabpage: 1})
diff --git a/src/version.c b/src/version.c
index 3be922580..4443e6eac 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    64,
 /**/
     63,
 /**/

-- 
-- 
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/E1vviSp-00Eat5-WB%40256bit.org.

Raspunde prin e-mail lui