diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-07-30 19:10:06 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-07-30 19:10:06 +0100 |
commit | 6747cf1671bd41cddee77c65b3f9a70509f968db (patch) | |
tree | d0d033e5b99251dfd408f8d0463727191b0e370a /src/ex_getln.c | |
parent | f39cfb72629f3e7fefaf578a3faa2619cd0654f8 (diff) | |
download | vim-git-6747cf1671bd41cddee77c65b3f9a70509f968db.tar.gz |
patch 9.0.0115: when 'cmdheight' is zero pressing ':' may scroll a windowv9.0.0115
Problem: When 'cmdheight' is zero pressing ':' may scroll a window.
Solution: Add the made_cmdheight_nonzero flag and set 'scrolloff' to zero.
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 58c83a85c..6c2a3a4b4 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1615,10 +1615,17 @@ getcmdline_int( if (cmdheight0) { - // If cmdheight is 0, cmdheight must be set to 1 when we enter command - // line. + int 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((char_u *)"ch", 1L, NULL, 0); update_screen(VALID); // redraw the screen NOW + made_cmdheight_nonzero = FALSE; + lastwin->w_p_so = save_so; } // one recursion level deeper @@ -2606,9 +2613,11 @@ theend: if (cmdheight0) { + made_cmdheight_nonzero = TRUE; set_option_value((char_u *)"ch", 0L, NULL, 0); // Redraw is needed for command line completion redraw_all_later(CLEAR); + made_cmdheight_nonzero = FALSE; } --depth; |