]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1871: Wrong 'showcmd' in the cmdwin v9.1.1871
authorzeertzjq <zeertzjq@outlook.com>
Sat, 25 Oct 2025 03:40:45 +0000 (03:40 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 25 Oct 2025 03:40:45 +0000 (03:40 +0000)
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 <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/ex_getln.c
src/testdir/dumps/Test_cmdwin_showcmd_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_cmdwin_showcmd_2.dump [new file with mode: 0644]
src/testdir/test_cmdwin.vim
src/version.c

index fd4f3bd96b81664abdd5d4220ae2d90240644999..73f8ca22d9b64623f68ba6de5b6a1e164180ce2c 100644 (file)
@@ -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 (file)
index 0000000..8785f14
--- /dev/null
@@ -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 (file)
index 0000000..65cc4ee
--- /dev/null
@@ -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| 
index 6b2850a0273960d20e08774c41bb839e800237a3..b25862dad7e6d0baed281369f8c17c52fb59dec7 100644 (file)
@@ -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
index 2d768c8f8b4cb6368457220b854a6c2cd7f67961..2526c09330fe4a2eb9c0277624d519371b9c7ba2 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1871,
 /**/
     1870,
 /**/