aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-26 14:04:46 +0800
committerGitHub <noreply@github.com>2022-12-26 14:04:46 +0800
commit94ce25065bb709794904b8ee96c1144006520750 (patch)
treea5a10ae8c34bd255af3c81757fd40b07be3c99c4
parent522b15e2a4d0a0f5a9e5958efa4ffcbb3606f131 (diff)
downloadrneovim-94ce25065bb709794904b8ee96c1144006520750.tar.gz
rneovim-94ce25065bb709794904b8ee96c1144006520750.tar.bz2
rneovim-94ce25065bb709794904b8ee96c1144006520750.zip
fix(showcmd): assert failure with cmdheight=0 (#21536)
-rw-r--r--src/nvim/normal.c3
-rw-r--r--test/functional/ui/cmdline_spec.lua13
2 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 1f7cc6c4f6..7979d2502e 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1990,6 +1990,9 @@ static void display_showcmd(void)
return;
}
// 'showcmdloc' is "last" or empty
+ if (p_ch == 0 && !ui_has(kUIMessages)) {
+ return;
+ }
if (ui_has(kUIMessages)) {
MAXSIZE_TEMP_ARRAY(content, 1);
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index c73c2d9f8a..1bdd55d66b 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -1351,4 +1351,17 @@ describe('cmdheight=0', function()
{1:~ }│{1:~ }|
]])
end)
+
+ it('no assert failure with showcmd', function()
+ command('set showcmd cmdheight=0')
+ feed('d')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]])
+ assert_alive()
+ end)
end)