diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index a59e7791c4..5e7e753d77 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4069,7 +4069,7 @@ void redrawcmd(void) // Typing ':' at the more prompt may set skip_redraw. We don't want this // in cmdline mode. skip_redraw = false; - + cmdline_was_last_drawn = true; redrawing_cmdline = false; } diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 5123dcb541..f5145f6cf4 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -1061,6 +1061,27 @@ describe('cmdline redraw', function() 1 substitution on 1 line | ]]) end) + + it('no empty cmdline after empty echo #18274', function() + feed(':foo') + api.nvim_echo({ { '' } }, false, {}) + screen:expect([[ + | + {1:~ }|*3 + :foo^ | + ]]) + feed(('o'):rep(screen._width - 4)) + -- No repeated cmdline redraws at screen width + screen:expect([[ + | + {1:~ }| + {3: }| + :fooooooooooooooooooooooo| + ^ | + ]]) + command('call timer_start(0, {-> 1})') + screen:expect_unchanged() + end) end) describe('statusline is redrawn on entering cmdline', function()