Commit: patch 9.1.1871: Wrong 'showcmd' in the cmdwin

1 view
Skip to first unread message

Christian Brabandt

unread,
Oct 25, 2025, 9:30:16 AM (7 days ago) Oct 25
to vim...@googlegroups.com
patch 9.1.1871: Wrong 'showcmd' in the cmdwin

Commit: https://github.com/vim/vim/commit/826326f13b0af34b5f1c6f15e480dfaece3787c6
Author: zeertzjq <zeer...@outlook.com>
Date: Sat Oct 25 03:40:45 2025 +0000

patch 9.1.1871: Wrong 'showcmd' in the cmdwin

Problem: Wrong 'showcmd' in the command-line window.
Solution: Clear 'showcmd' when entering cmdwin (zeertzjq).

related: neovim/neovim#36271
closes: #18616

Signed-off-by: zeertzjq <zeer...@outlook.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/ex_getln.c b/src/ex_getln.c
index fd4f3bd96..73f8ca22d 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4846,6 +4846,7 @@ open_cmdwin(void)

State = MODE_NORMAL;
setmouse();
+ clear_showcmd();

// Reset here so it can be set by a CmdwinEnter autocommand.
cmdwin_result = 0;
diff --git a/src/testdir/dumps/Test_cmdwin_showcmd_1.dump b/src/testdir/dumps/Test_cmdwin_showcmd_1.dump
new file mode 100644
index 000000000..8785f1468
--- /dev/null
+++ b/src/testdir/dumps/Test_cmdwin_showcmd_1.dump
@@ -0,0 +1,18 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|[+1#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+|:+0#4040ff13&> +0#0000000&@73
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|[+3#0000000&|C|o|m@1|a|n|d| |L|i|n|e|]| @42|1|,|0|-|1| @9|A|l@1
+|:+0&&| @73
diff --git a/src/testdir/dumps/Test_cmdwin_showcmd_2.dump b/src/testdir/dumps/Test_cmdwin_showcmd_2.dump
new file mode 100644
index 000000000..65cc4ee96
--- /dev/null
+++ b/src/testdir/dumps/Test_cmdwin_showcmd_2.dump
@@ -0,0 +1,18 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/test_cmdwin.vim b/src/testdir/test_cmdwin.vim
index 6b2850a02..b25862dad 100644
--- a/src/testdir/test_cmdwin.vim
+++ b/src/testdir/test_cmdwin.vim
@@ -582,4 +582,33 @@ func Test_cmdwin_existing_bufname()
delfunc CheckName
endfunc

+func Test_cmdwin_showcmd()
+ CheckScreendump
+
+ let lines =<< trim [SCRIPT]
+ augroup vimHints | au! | augroup END
+ set showcmd
+ [SCRIPT]
+ call writefile(lines, 'XTest_cmdwin_showcmd', 'D')
+ let buf = RunVimInTerminal('-S XTest_cmdwin_showcmd', {'rows': 18})
+
+ for keys in ['q:', ":\<C-F>"]
+ call term_sendkeys(buf, keys)
+ call VerifyScreenDump(buf, 'Test_cmdwin_showcmd_1', {})
+ call term_sendkeys(buf, '"')
+ call WaitForAssert({-> assert_match('^: \+" *$', term_getline(buf, 18))})
+ call term_sendkeys(buf, 'x')
+ call WaitForAssert({-> assert_match('^: \+"x *$', term_getline(buf, 18))})
+ call term_sendkeys(buf, 'y')
+ call WaitForAssert({-> assert_match('^: \+"xy *$', term_getline(buf, 18))})
+ call term_sendkeys(buf, 'y')
+ call WaitForAssert({-> assert_match('^: \+$', term_getline(buf, 18))})
+ call term_sendkeys(buf, "\<C-C>\<C-C>")
+ call VerifyScreenDump(buf, 'Test_cmdwin_showcmd_2', {})
+ endfor
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 2d768c8f8..2526c0933 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =

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