]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0423: popup: wrapped cmdline truncated with wildoptions=pum v9.2.0423
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Fri, 1 May 2026 13:25:31 +0000 (13:25 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 1 May 2026 13:25:31 +0000 (13:25 +0000)
Problem:  popup: wrapped cmdline truncated with wildoptions=pum
Solution: Call msg_starthere() in redrawcmd() to reset lines_left
          before each redraw (Yasuhiro Matsumoto).

redrawcmd() leaves lines_left at its previous value, which decrements
across successive redraws (e.g. when wildtrigger() refreshes the popup
on every keystroke) until 0, after which msg_no_more aborts drawing
the wrapped cmdline. Call msg_starthere() to reset it.

related: #20081

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/ex_getln.c
src/testdir/dumps/Test_wildtrigger_wrapped_cmdline_1.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/version.c

index 1124f458655141cec2de2f8aea0983d28135d9be..e5a9ce776f1f43aa4aa8d7751b9bb6e5d75f0cfb 100644 (file)
@@ -4122,6 +4122,8 @@ redrawcmd(void)
 
     sb_text_restart_cmdline();
     msg_start();
+    // Reset lines_left so a wrapped cmdline isn't truncated by msg_no_more.
+    msg_starthere();
     redrawcmdprompt();
 
     // Don't use more prompt, truncate the cmdline if it doesn't fit.
diff --git a/src/testdir/dumps/Test_wildtrigger_wrapped_cmdline_1.dump b/src/testdir/dumps/Test_wildtrigger_wrapped_cmdline_1.dump
new file mode 100644 (file)
index 0000000..409cf54
--- /dev/null
@@ -0,0 +1,8 @@
+|~+0#4040ff13#ffffff0| @28
+|~| @28
+|~| @28
+|~| @28
+|~| @28
+|~| @28
+|:+0#0000000&|e| |x@26
+@13> @16
index ee5f668bb2aa564c028e4b60a5ff5fd7fb151ae2..e793292ff7bb67b861b5cd3cbc70bea50892af24 100644 (file)
@@ -5249,6 +5249,32 @@ func Test_wildtrigger_update_screen()
   call StopVimInTerminal(buf)
 endfunc
 
+" Wrapped cmdline must not be truncated when wildtrigger() redraws on every
+" keystroke.
+func Test_wildtrigger_wrapped_cmdline()
+  CheckScreendump
+
+  let lines =<< trim [SCRIPT]
+    set wildmenu wildmode=noselect:lastused,full wildoptions=pum
+    cnoremap <F8> <C-R>=wildtrigger()[-1]<CR>
+  [SCRIPT]
+  call writefile(lines, 'XTest_wildtrigger_wrap', 'D')
+  let rows = 8
+  let cols = 30
+  let buf = RunVimInTerminal('-S XTest_wildtrigger_wrap', {'rows': rows, 'cols': cols})
+
+  call term_sendkeys(buf, ":e ")
+  for i in range(40)
+    call term_sendkeys(buf, "x\<F8>")
+  endfor
+
+  call WaitForTermCurPosAndLinesToMatch(buf, [rows, ((3 + 40) - cols + 1)])
+  call VerifyScreenDump(buf, 'Test_wildtrigger_wrapped_cmdline_1', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+endfunc
+
 " Issue #17969: With 'noselect', the popup menu should appear next to the
 " environment variable being expanded. Disable 'showtail' when completing
 " file paths when 'noselect' is present.
index 9a28bf20e13b4e58813c3ad805db6b29ea2e105c..dca5176357053c9b4144ddc57a262d2300bb8555 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    423,
 /**/
     422,
 /**/