mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.0115: when 'cmdheight' is zero pressing ':' may scroll a window
Problem: When 'cmdheight' is zero pressing ':' may scroll a window.
Solution: Add the made_cmdheight_nonzero flag and set 'scrolloff' to zero.
6747cf1671
This commit is contained in:
parent
81a1d26c3e
commit
63244f68e7
@ -692,9 +692,19 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
|
||||
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,10 +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;
|
||||
|
@ -1084,4 +1084,7 @@ EXTERN char windowsVersion[20] INIT(= { 0 });
|
||||
|
||||
EXTERN int exit_need_delay INIT(= 0);
|
||||
|
||||
// Set when 'cmdheight' is changed from non-zero to one temporarily.
|
||||
EXTERN int made_cmdheight_nonzero INIT(= false);
|
||||
|
||||
#endif // NVIM_GLOBALS_H
|
||||
|
@ -6306,7 +6306,8 @@ void win_set_inner_size(win_T *wp)
|
||||
|
||||
// There is no point in adjusting the scroll position when exiting. Some
|
||||
// values might be invalid.
|
||||
if (!exiting) {
|
||||
// Skip scroll_to_fraction() when 'cmdheight' was set to one from zero.
|
||||
if (!exiting && !made_cmdheight_nonzero) {
|
||||
scroll_to_fraction(wp, prev_height);
|
||||
}
|
||||
redraw_later(wp, NOT_VALID); // SOME_VALID??
|
||||
|
Loading…
Reference in New Issue
Block a user