]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0907: popup: virtual text is not redrawn when a text property changes master v9.2.0907
authorHirohito Higashi <h.east.727@gmail.com>
Mon, 3 Aug 2026 20:38:42 +0000 (20:38 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 3 Aug 2026 20:38:42 +0000 (20:38 +0000)
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) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/drawscreen.c
src/testdir/dumps/Test_popupwin_textprop_redraw_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_popupwin_textprop_redraw_2.dump [new file with mode: 0644]
src/testdir/test_popupwin.vim
src/version.c

index f5271e7c17fdc83336361f0ebc24e7612ebfcdf4..d85ae57dcee0662a43533936838d177516ba5f80 100644 (file)
@@ -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 (file)
index 0000000..27326b4
--- /dev/null
@@ -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 (file)
index 0000000..f713073
--- /dev/null
@@ -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| 
index 2663c52da2715cdc99ff5b001aab3200517629f0..68267310905c55d2887727fc4c5078c7b14041c8 100644 (file)
@@ -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
index 13c9fc7d31780ba89215987eb1bbc13bdf60f664..5a748f4996d96409ecbde5b7e844a237403313f1 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    907,
 /**/
     906,
 /**/