Commit: patch 9.2.0907: popup: virtual text is not redrawn when a text property changes

3 views
Skip to first unread message

Christian Brabandt

unread,
Aug 3, 2026, 4:45:19 PM (19 hours ago) Aug 3
to vim...@googlegroups.com
patch 9.2.0907: popup: virtual text is not redrawn when a text property changes

Commit: https://github.com/vim/vim/commit/28698bca20dd3970cd7a7e2996ecc74ce00f151b
Author: Hirohito Higashi <h.eas...@gmail.com>
Date: Mon Aug 3 20:38:42 2026 +0000

patch 9.2.0907: popup: virtual text is not redrawn when a text property changes

Problem: Adding or removing a text property in the buffer of a popup
window does not update the popup on the screen. The old
virtual text stays visible until something else causes a
redraw.
Solution: Also mark popup windows displaying the buffer for redrawing in
redraw_buf_later() (Hirohito Higashi).

fixes: #19297
closes: #20931

Co-Authored-By: Claude Opus 5 (1M context) <nor...@anthropic.com>
Signed-off-by: Hirohito Higashi <h.eas...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/drawscreen.c b/src/drawscreen.c
index f5271e7c1..d85ae57dc 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -3443,6 +3443,15 @@ redraw_buf_later(buf_T *buf, int type)
if (wp->w_buffer == buf)
redraw_win_later(wp, type);
}
+#ifdef FEAT_PROP_POPUP
+ // popup windows are not in the list of windows
+ FOR_ALL_POPUPWINS(wp)
+ if (wp->w_buffer == buf)
+ redraw_win_later(wp, type);
+ FOR_ALL_POPUPWINS_IN_TAB(curtab, wp)
+ if (wp->w_buffer == buf)
+ redraw_win_later(wp, type);
+#endif
#if defined(FEAT_TERMINAL) && defined(FEAT_PROP_POPUP)
// terminal in popup window is not in list of windows
if (curwin->w_buffer == buf)
diff --git a/src/testdir/dumps/Test_popupwin_textprop_redraw_1.dump b/src/testdir/dumps/Test_popupwin_textprop_redraw_1.dump
new file mode 100644
index 000000000..27326b4ee
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_textprop_redraw_1.dump
@@ -0,0 +1,10 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| |╔+0#0000001#ffd7ff255|═@29|╗| +0#4040ff13#ffffff0@40
+|~| |║+0#0000001#ffd7ff255|p|o|p|u|p| |t|e|x|t| @11|c+0&#ffff4012|o|u|n|t|=|1| |║+0&#ffd7ff255| +0#4040ff13#ffffff0@40
+|~| |╚+0#0000001#ffd7ff255|═@29|╝| +0#4040ff13#ffffff0@40
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|"+0#0000000&|X|p|o|p|u|p|P|r|o|p|"| |[|N|e|w|]| @38|0|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_popupwin_textprop_redraw_2.dump b/src/testdir/dumps/Test_popupwin_textprop_redraw_2.dump
new file mode 100644
index 000000000..f713073d6
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_textprop_redraw_2.dump
@@ -0,0 +1,10 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| |╔+0#0000001#ffd7ff255|═@29|╗| +0#4040ff13#ffffff0@40
+|~| |║+0#0000001#ffd7ff255|p|o|p|u|p| |t|e|x|t| @11|c+0&#ffff4012|o|u|n|t|=|2| |║+0&#ffd7ff255| +0#4040ff13#ffffff0@40
+|~| |╚+0#0000001#ffd7ff255|═@29|╝| +0#4040ff13#ffffff0@40
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|"+0#0000000&|X|p|o|p|u|p|P|r|o|p|"| |[|N|e|w|]| @38|0|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 2663c52da..682673109 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -6243,4 +6243,41 @@ func Test_popup_image_clipwindow_scroll()
call prop_type_delete('imgclipprop')
endfunc

+func Test_popupwin_textprop_redraw()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ var buf = bufadd('XpopupProp')
+ bufload(buf)
+ setbufline(buf, 1, 'popup text')
+ prop_type_add('counter', {bufnr: buf, highlight: 'Search'})
+ popup_create(buf, {line: 3, col: 3, minwidth: 30, border: []})
+
+ var counter = 0
+ def g:UpdateProp()
+ counter += 1
+ prop_remove({all: true, type: 'counter', bufnr: buf}, 1)
+ prop_add(1, 0, {
+ bufnr: buf,
+ type: 'counter',
+ text: $'count={counter} ',
+ text_align: 'right',
+ })
+ enddef
+ nnoremap <F3> <ScriptCmd>g:UpdateProp()<CR>
+ END
+ call writefile(lines, 'XtestPopupProp', 'D')
+ let buf = RunVimInTerminal('-S XtestPopupProp', #{rows: 10})
+
+ " Updating only the virtual text of the popup buffer must redraw the popup.
+ call term_sendkeys(buf, "\<F3>")
+ call VerifyScreenDump(buf, 'Test_popupwin_textprop_redraw_1', {})
+
+ call term_sendkeys(buf, "\<F3>")
+ call VerifyScreenDump(buf, 'Test_popupwin_textprop_redraw_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2
diff --git a/src/version.c b/src/version.c
index 13c9fc7d3..5a748f499 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =

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