Skip to content

Commit

Permalink
vim-patch:9.1.0855: setting 'cmdheight' may missing output (neovim#31216
Browse files Browse the repository at this point in the history
)

Problem:  setting 'cmdheight' may cause hit-enter-prompt and echo output
          to be missing
Solution: Before cleaning the cmdline, check the need_wait_return flag
          (nwounkn)

closes: vim/vim#13432

vim/vim@2e48567

Co-authored-by: nwounkn <[email protected]>
  • Loading branch information
zeertzjq and nwounkn authored Nov 15, 2024
1 parent fa0dcde commit 54c85bc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/nvim/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
22 changes: 21 additions & 1 deletion test/functional/legacy/cmdline_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -151,6 +158,8 @@ describe('cmdline', function()
set cmdheight=1
endfunc
]])

-- setting 'cmdheight' works after outputting two messages
feed(':call EchoTwo()')
screen:expect([[
|
Expand All @@ -165,6 +174,17 @@ describe('cmdline', function()
{3:[No Name] }|
|
]])

-- increasing 'cmdheight' doesn't clear the messages that need hit-enter
feed(':call EchoOne()<CR>')
screen:expect([[
|
{1:~ }|*3
{3: }|
foo |
bar |
{6:Press ENTER or type command to continue}^ |
]])
end)

-- oldtest: Test_cmdheight_tabline()
Expand Down
10 changes: 10 additions & 0 deletions test/old/testdir/test_cmdline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -306,6 +312,10 @@ func Test_changing_cmdheight()
call term_sendkeys(buf, ":call EchoTwo()\<CR>")
call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {})

" increasing 'cmdheight' doesn't clear the messages that need hit-enter
call term_sendkeys(buf, ":call EchoOne()\<CR>")
call VerifyScreenDump(buf, 'Test_changing_cmdheight_7', {})

" clean up
call StopVimInTerminal(buf)
endfunc
Expand Down

0 comments on commit 54c85bc

Please sign in to comment.