From 97c5bed84b5a0b5a861007e23aaccfc76c519b34 Mon Sep 17 00:00:00 2001 From: Hirohito Higashi Date: Thu, 26 Feb 2026 20:49:06 +0000 Subject: [PATCH] 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 Signed-off-by: Christian Brabandt --- src/popupwin.c | 10 ++++++---- .../Test_popupwin_opacity_100_blocks_bg.dump | 10 ++++++++++ src/testdir/test_popupwin.vim | 17 +++++++++++++++++ src/version.c | 2 ++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 src/testdir/dumps/Test_popupwin_opacity_100_blocks_bg.dump diff --git a/src/popupwin.c b/src/popupwin.c index e7ab2687e7..267ffb6ff6 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 0000000000..362259bdee --- /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 24d8fab573..4c41bf75d6 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 3be9225805..4443e6eac9 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, /**/ -- 2.47.3