diff --git a/src/nvim/window.c b/src/nvim/window.c index 5147bbd23b..5f17d3220d 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6814,11 +6814,13 @@ void command_height(void) // Recompute window positions. win_comp_pos(); - // clear the lines added to cmdline - if (full_screen) { - grid_clear(&default_grid, cmdline_row, Rows, 0, Columns, 0); + if (!need_wait_return) { + // clear the lines added to cmdline + if (full_screen) { + grid_clear(&default_grid, cmdline_row, Rows, 0, Columns, 0); + } + msg_row = cmdline_row; } - msg_row = cmdline_row; redraw_cmdline = true; return; } diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 7ab2793341..bf146e1322 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -139,10 +139,17 @@ describe('cmdline', function() ]]) end) - it("setting 'cmdheight' works after outputting two messages vim-patch:9.0.0665", function() + -- oldtest: Test_changing_cmdheight() + it("changing 'cmdheight'", function() local screen = Screen.new(60, 8) exec([[ set cmdheight=1 laststatus=2 + func EchoOne() + set laststatus=2 cmdheight=1 + echo 'foo' + echo 'bar' + set cmdheight=2 + endfunc func EchoTwo() set laststatus=2 set cmdheight=5 @@ -151,6 +158,8 @@ describe('cmdline', function() set cmdheight=1 endfunc ]]) + + -- setting 'cmdheight' works after outputting two messages feed(':call EchoTwo()') screen:expect([[ | @@ -165,6 +174,17 @@ describe('cmdline', function() {3:[No Name] }| | ]]) + + -- increasing 'cmdheight' doesn't clear the messages that need hit-enter + feed(':call EchoOne()') + screen:expect([[ + | + {1:~ }|*3 + {3: }| + foo | + bar | + {6:Press ENTER or type command to continue}^ | + ]]) end) -- oldtest: Test_cmdheight_tabline() diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 8d405790e9..290af4a4ca 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -271,6 +271,12 @@ func Test_changing_cmdheight() let lines =<< trim END set cmdheight=1 laststatus=2 + func EchoOne() + set laststatus=2 cmdheight=1 + echo 'foo' + echo 'bar' + set cmdheight=2 + endfunc func EchoTwo() set laststatus=2 set cmdheight=5 @@ -306,6 +312,10 @@ func Test_changing_cmdheight() call term_sendkeys(buf, ":call EchoTwo()\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {}) + " increasing 'cmdheight' doesn't clear the messages that need hit-enter + call term_sendkeys(buf, ":call EchoOne()\") + call VerifyScreenDump(buf, 'Test_changing_cmdheight_7', {}) + " clean up call StopVimInTerminal(buf) endfunc