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

Christian Brabandt <[email protected]> Mon, 3 Aug 2026 22:45:09 +0200
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
patch 9.2.0907: popup: virtual text is not redrawn when a text property cha=
nges

Commit: https://github.com/vim/vim/commit/28698bca20dd3970cd7a7e2996ecc74ce=
00f151b
Author: Hirohito Higashi <[email protected]>
Date:   Mon Aug 3 20:38:42 2026 +0000

    patch 9.2.0907: popup: virtual text is not redrawn when a text property=
 changes
   =20
    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 i=
n
              redraw_buf_later() (Hirohito Higashi).
   =20
    fixes:  #19297
    closes: #20931
   =20
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    Signed-off-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

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 =3D=3D 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 =3D=3D buf)
+	    redraw_win_later(wp, type);
+    FOR_ALL_POPUPWINS_IN_TAB(curtab, wp)
+	if (wp->w_buffer =3D=3D 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 =3D=3D buf)
diff --git a/src/testdir/dumps/Test_popupwin_textprop_redraw_1.dump b/src/t=
estdir/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
+|~| |=E2=95=94+0#0000001#ffd7ff255|=E2=95=90@29|=E2=95=97| +0#4040ff13#fff=
fff0@40
+|~| |=E2=95=91+0#0000001#ffd7ff255|p|o|p|u|p| |t|e|x|t| @11|c+0&#ffff4012|=
o|u|n|t|=3D|1| |=E2=95=91+0&#ffd7ff255| +0#4040ff13#ffffff0@40
+|~| |=E2=95=9A+0#0000001#ffd7ff255|=E2=95=90@29|=E2=95=9D| +0#4040ff13#fff=
fff0@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|=
=20
diff --git a/src/testdir/dumps/Test_popupwin_textprop_redraw_2.dump b/src/t=
estdir/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
+|~| |=E2=95=94+0#0000001#ffd7ff255|=E2=95=90@29|=E2=95=97| +0#4040ff13#fff=
fff0@40
+|~| |=E2=95=91+0#0000001#ffd7ff255|p|o|p|u|p| |t|e|x|t| @11|c+0&#ffff4012|=
o|u|n|t|=3D|2| |=E2=95=91+0&#ffd7ff255| +0#4040ff13#ffffff0@40
+|~| |=E2=95=9A+0#0000001#ffd7ff255|=E2=95=90@29|=E2=95=9D| +0#4040ff13#fff=
fff0@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|=
=20
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
=20
+func Test_popupwin_textprop_redraw()
+  CheckScreendump
+
+  let lines =3D<< trim END
+    vim9script
+    var buf =3D 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 =3D 0
+    def g:UpdateProp()
+      counter +=3D 1
+      prop_remove({all: true, type: 'counter', bufnr: buf}, 1)
+      prop_add(1, 0, {
+        bufnr: buf,
+        type: 'counter',
+        text: $'count=3D{counter} ',
+        text_align: 'right',
+      })
+    enddef
+    nnoremap <F3> <ScriptCmd>g:UpdateProp()<CR>
+  END
+  call writefile(lines, 'XtestPopupProp', 'D')
+  let buf =3D RunVimInTerminal('-S XtestPopupProp', #{rows: 10})
+
+  " Updating only the virtual text of the popup buffer must redraw the pop=
up.
+  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=3D2 sts=3D2
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[]) =3D
=20
 static int included_patches[] =3D
 {   /* Add new patch number below this line */
+/**/
+    907,
 /**/
     906,
 /**/

--=20
--=20
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

---=20
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 e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1w=
qzX3-00BQz5-AH%40256bit.org.