commit 94ce25065bb709794904b8ee96c1144006520750
parent 522b15e2a4d0a0f5a9e5958efa4ffcbb3606f131
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon, 26 Dec 2022 14:04:46 +0800
fix(showcmd): assert failure with cmdheight=0 (#21536)
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git 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
@@ -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)