diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-31 19:13:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-31 19:13:45 +0800 |
commit | 380417c1ddbd90b084ed27f321b575de34998a9b (patch) | |
tree | 99171207e25340bc6bb1b3466f5c192d50d03a4f /src/nvim/ex_getln.c | |
parent | abc087f4c65ca547cae58518b42aee82ff4a07f6 (diff) | |
parent | 2c522854c78d4e02d7337cf0b06174387f7f4583 (diff) | |
download | rneovim-380417c1ddbd90b084ed27f321b575de34998a9b.tar.gz rneovim-380417c1ddbd90b084ed27f321b575de34998a9b.tar.bz2 rneovim-380417c1ddbd90b084ed27f321b575de34998a9b.zip |
Merge pull request #19587 from Shougo/vim-9.0.0114
vim-patch:9.0.{0114,0115,0118}
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 815eeb8de5..a6e8ad433f 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -689,12 +689,22 @@ static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool /// @param init_ccline clear ccline first static uint8_t *command_line_enter(int firstc, long count, int indent, bool init_ccline) { - bool cmdheight0 = !ui_has_messages(); + const bool cmdheight0 = !ui_has_messages(); if (cmdheight0) { - // If cmdheight is 0, cmdheight must be set to 1 when we enter command line. + const long save_so = lastwin->w_p_so; + + // If cmdheight is 0, cmdheight must be set to 1 when we enter the + // command line. Set "made_cmdheight_nonzero" and reset 'scrolloff' to + // avoid scrolling the last window. + made_cmdheight_nonzero = true; + + lastwin->w_p_so = 0; set_option_value("ch", 1L, NULL, 0); update_screen(VALID); // redraw the screen NOW + + made_cmdheight_nonzero = false; + lastwin->w_p_so = save_so; } // can be invoked recursively, identify each level @@ -991,11 +1001,14 @@ theend: } if (cmdheight0) { + made_cmdheight_nonzero = true; + // Restore cmdheight set_option_value("ch", 0L, NULL, 0); - // Redraw is needed for command line completion redraw_all_later(CLEAR); + + made_cmdheight_nonzero = false; } return p; |