diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-09-26 13:30:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 13:30:19 +0200 |
commit | c7e74f78896ffe933e9e411563eaaaacca2622ce (patch) | |
tree | 55ad87ed71653c79d7a562733e53bde0011cd2ba | |
parent | c815aadfccd6bada47ecfb09fe188ee7f7c5caf3 (diff) | |
parent | be72af2f9b6aa9ff57ef21eb4e517a74b7c2a2da (diff) | |
download | rneovim-c7e74f78896ffe933e9e411563eaaaacca2622ce.tar.gz rneovim-c7e74f78896ffe933e9e411563eaaaacca2622ce.tar.bz2 rneovim-c7e74f78896ffe933e9e411563eaaaacca2622ce.zip |
Merge pull request #20351 from bfredl/cmdfix2
fix(cmdline): don't send invalid cursor with incsearch and cmdheight=0
-rw-r--r-- | src/nvim/message.c | 14 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 42 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 1 |
3 files changed, 51 insertions, 6 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index b3e99d99a1..e0b0dfb0bc 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1399,13 +1399,15 @@ void msg_start(void) msg_clr_eos(); } + // if cmdheight=0, we need to scroll in the first line of msg_grid upon the screen + if (p_ch == 0 && !ui_has(kUIMessages) && !msg_scrolled) { + msg_grid_validate(); + msg_scroll_up(false, true); + msg_scrolled++; + cmdline_row = Rows - 1; + } + if (!msg_scroll && full_screen) { // overwrite last message - if (cmdline_row >= Rows && !ui_has(kUIMessages)) { - msg_grid_validate(); - msg_scroll_up(false, true); - msg_scrolled++; - cmdline_row = Rows - 1; - } msg_row = cmdline_row; msg_col = cmdmsg_rl ? Columns - 1 : 0; } else if (msg_didout || (p_ch == 0 && !ui_has(kUIMessages))) { // start message on next line diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 3669352901..845291b2eb 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -1196,4 +1196,46 @@ describe('cmdheight=0', function() {1:~ }| ]]} end) + + it('with multigrid', function() + clear{args={'--cmd', 'set cmdheight=0'}} + screen:attach{ext_multigrid=true} + screen:expect{grid=[[ + ## grid 1 + [2:-------------------------]| + [2:-------------------------]| + [2:-------------------------]| + [2:-------------------------]| + [2:-------------------------]| + ## grid 2 + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + ]], win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; + }} + + feed '/p' + screen:expect{grid=[[ + ## grid 1 + [2:-------------------------]| + [2:-------------------------]| + [2:-------------------------]| + [2:-------------------------]| + [3:-------------------------]| + ## grid 2 + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + /p^ | + ]], win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; + }} + end) end) diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 6ee9e7b393..028fa2825d 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -769,6 +769,7 @@ end function Screen:_handle_grid_cursor_goto(grid, row, col) self._cursor.grid = grid + assert(row >= 0 and col >= 0) self._cursor.row = row + 1 self._cursor.col = col + 1 end |