patch 9.2.0468: popups: not correctly updated from a CmdlineChanged autocommand

Commit: 
https://github.com/vim/vim/commit/ef1ecc3b61fd9f462ae3571ed98dd09457659e63
Author: Yasuhiro Matsumoto <[email protected]>
Date:   Sun May 10 18:20:01 2026 +0000

    patch 9.2.0468: popups: not correctly updated from a CmdlineChanged 
autocommand
    
    Problem:  popup_show() from a CmdlineChanged autocommand doesn't update
              the screen (Mao-Yining)
    Solution: Refresh the screen when popups need redraw
              (Yasuhiro Matsumoto).
    
    popup_settext()/popup_show() called from a CmdlineChanged autocommand
    did not refresh the screen because cmdline mode normally skips
    update_screen(), so async info-popup updates only became visible after
    a manual :redraw.  Refresh the screen when popups need redrawing right
    after the autocommand.
    
    fixes:  #20175
    closes: #20179
    
    Signed-off-by: Yasuhiro Matsumoto <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/ex_getln.c b/src/ex_getln.c
index e5a9ce776..7e26d6cdb 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2696,7 +2696,17 @@ cmdline_changed:
                && (ccline.cmdpos != prev_cmdpos
                    || (prev_cmdbuff != NULL &&
                        STRCMP(prev_cmdbuff, ccline.cmdbuff) != 0)))
+       {
            trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
+#ifdef FEAT_PROP_POPUP
+           // Show popup updates from the autocmd without a manual :redraw.
+           if (popup_need_redraw())
+           {
+               update_screen(0);
+               redrawcmd();
+           }
+#endif
+       }
 
        // Trigger CursorMovedC autocommands.
        if (ccline.cmdpos != prev_cmdpos)
diff --git a/src/testdir/dumps/Test_wildmenu_pum_info_async_update.dump 
b/src/testdir/dumps/Test_wildmenu_pum_info_async_update.dump
new file mode 100644
index 000000000..249f509e2
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_info_async_update.dump
@@ -0,0 +1,14 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @19|╔+0#0000001#e0e0e08|═@5|X| +0#4040ff13#ffffff0@20
+|~| @3| +0#0000001#e0e0e08|1| @13|║| |d|o|n|e| |║| +0#4040ff13#ffffff0@20
+|~| @3| +0#0000001#ffd7ff255|2| @13|╚+0&#e0e0e08|═@5|⇲| +0#4040ff13#ffffff0@20
+|:+0#0000000&|T|e|s|t| |1> @42
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index c10cff90b..7c1365b6a 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -3190,6 +3190,48 @@ func Test_wildmenu_pum()
   call StopVimInTerminal(buf)
 endfunc
 
+" Test that popup_settext() from a CmdlineChanged autocmd updates the
+" cmdline-mode info popup without needing an explicit :redraw (#20175).
+func Test_wildmenu_pum_info_async_update()
+  CheckScreendump
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      vim9script
+      set completeopt=menuone,popup
+      set wildmenu wildoptions=pum wildcharm=<Tab>
+      augroup Test
+          au!
+          au CmdlineChanged : UpdateInfo()
+      augroup END
+
+      def UpdateInfo()
+          if getcmdcompltype() != 'customlist,Complete'
+              return
+          endif
+          var id = popup_findinfo()
+          if id != 0
+              id->popup_settext('done')
+              popup_show(id)
+          endif
+      enddef
+
+      def Complete(_, _, _): list<dict<any>>
+          return [{word: '1', info: 'lazy'}, {word: '2', info: 'lazy'}]
+      enddef
+
+      command! -nargs=1 -complete=customlist,Complete Test echo <args>
+  END
+  call writefile(lines, 'XtestWildmenuInfoAsync', 'D')
+  let buf = RunVimInTerminal('-S XtestWildmenuInfoAsync', #{rows: 14, cols: 
50})
+  call term_sendkeys(buf, ":Test \<Tab>")
+  call TermWait(buf, 200)
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_info_async_update', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+endfunc
+
 " Test for wildmenumode() with the cmdline popup menu
 func Test_wildmenumode_with_pum()
   set wildmenu
diff --git a/src/version.c b/src/version.c
index a5ba4c796..f1e40ddb2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    468,
 /**/
     467,
 /**/

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

--- 
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 email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wM8ul-00FlOf-P5%40256bit.org.

Raspunde prin e-mail lui