]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0064: popup: opacity feature causes flickering v9.2.0064
authorHirohito Higashi <h.east.727@gmail.com>
Thu, 26 Feb 2026 20:49:06 +0000 (20:49 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 26 Feb 2026 20:49:06 +0000 (20:49 +0000)
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 <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupwin.c
src/testdir/dumps/Test_popupwin_opacity_100_blocks_bg.dump [new file with mode: 0644]
src/testdir/test_popupwin.vim
src/version.c

index e7ab2687e76832ba998a1bfc304028546b2d9f95..267ffb6ff604a8d568653b41052bf1838c193f2c 100644 (file)
@@ -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 (file)
index 0000000..362259b
--- /dev/null
@@ -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| 
index 24d8fab573b676cab19aa6a93be147be56337ac4..4c41bf75d62740c85a17a2512346e2dca6fc2ea2 100644 (file)
@@ -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})
index 3be92258059a6a50cd4fc5562cc0f9ff1dcd4c4b..4443e6eac968cd910f9f21b0fd08d8d5449c3259 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    64,
 /**/
     63,
 /**/