mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.0190: the way 'cmdheight' can be made zero is inconsistent
Problem: The way 'cmdheight' can be made zero is inconsistent.
Solution: Only make 'cmdheight' zero when setting it explicitly, not when
resizing windows. (closes vim/vim#10890)
f797e309ca
This commit is contained in:
parent
d74f9c3b94
commit
5977a96b3f
@ -126,6 +126,35 @@ func Test_wildmenu_screendump()
|
|||||||
call delete('XTest_wildmenu')
|
call delete('XTest_wildmenu')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_changing_cmdheight()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set cmdheight=1 laststatus=2
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XTest_cmdheight')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S XTest_cmdheight', {'rows': 8})
|
||||||
|
call term_sendkeys(buf, ":resize -3\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_changing_cmdheight_1', {})
|
||||||
|
|
||||||
|
" using the space available doesn't change the status line
|
||||||
|
call term_sendkeys(buf, ":set cmdheight+=3\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {})
|
||||||
|
|
||||||
|
" using more space moves the status line up
|
||||||
|
call term_sendkeys(buf, ":set cmdheight+=1\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_changing_cmdheight_3', {})
|
||||||
|
|
||||||
|
" reducing cmdheight moves status line down
|
||||||
|
call term_sendkeys(buf, ":set cmdheight-=2\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_changing_cmdheight_4', {})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XTest_cmdheight')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_map_completion()
|
func Test_map_completion()
|
||||||
if !has('cmdline_compl')
|
if !has('cmdline_compl')
|
||||||
return
|
return
|
||||||
|
@ -5552,7 +5552,7 @@ static void frame_setheight(frame_T *curfrp, int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (curfrp->fr_parent == NULL) {
|
if (curfrp->fr_parent == NULL) {
|
||||||
// topframe: can only change the command line
|
// topframe: can only change the command line height
|
||||||
if (height > ROWS_AVAIL) {
|
if (height > ROWS_AVAIL) {
|
||||||
// If height is greater than the available space, try to create space for
|
// If height is greater than the available space, try to create space for
|
||||||
// the frame by reducing 'cmdheight' if possible, while making sure
|
// the frame by reducing 'cmdheight' if possible, while making sure
|
||||||
@ -5915,6 +5915,13 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|||||||
int row;
|
int row;
|
||||||
bool up; // if true, drag status line up, otherwise down
|
bool up; // if true, drag status line up, otherwise down
|
||||||
int n;
|
int n;
|
||||||
|
static bool p_ch_was_zero = false;
|
||||||
|
|
||||||
|
// If the user explicitly set 'cmdheight' to zero, then allow for dragging
|
||||||
|
// the status line making it zero again.
|
||||||
|
if (p_ch == 0) {
|
||||||
|
p_ch_was_zero = true;
|
||||||
|
}
|
||||||
|
|
||||||
fr = dragwin->w_frame;
|
fr = dragwin->w_frame;
|
||||||
curfr = fr;
|
curfr = fr;
|
||||||
@ -5965,6 +5972,8 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|||||||
room = Rows - cmdline_row;
|
room = Rows - cmdline_row;
|
||||||
if (curfr->fr_next != NULL) {
|
if (curfr->fr_next != NULL) {
|
||||||
room -= (int)p_ch + global_stl_height();
|
room -= (int)p_ch + global_stl_height();
|
||||||
|
} else if (!p_ch_was_zero) {
|
||||||
|
room--;
|
||||||
}
|
}
|
||||||
if (room < 0) {
|
if (room < 0) {
|
||||||
room = 0;
|
room = 0;
|
||||||
@ -6020,7 +6029,7 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|||||||
clear_cmdline = true;
|
clear_cmdline = true;
|
||||||
}
|
}
|
||||||
cmdline_row = row;
|
cmdline_row = row;
|
||||||
p_ch = MAX(Rows - cmdline_row, 0);
|
p_ch = MAX(Rows - cmdline_row, p_ch_was_zero ? 0 : 1);
|
||||||
curtab->tp_ch_used = p_ch;
|
curtab->tp_ch_used = p_ch;
|
||||||
redraw_all_later(SOME_VALID);
|
redraw_all_later(SOME_VALID);
|
||||||
showmode();
|
showmode();
|
||||||
@ -6384,6 +6393,12 @@ void command_height(void)
|
|||||||
// p_ch was changed in another tab page.
|
// p_ch was changed in another tab page.
|
||||||
curtab->tp_ch_used = p_ch;
|
curtab->tp_ch_used = p_ch;
|
||||||
|
|
||||||
|
// If the space for the command line is already more than 'cmdheight' there
|
||||||
|
// is nothing to do (window size must have decreased).
|
||||||
|
if (p_ch > old_p_ch && cmdline_row <= Rows - p_ch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Find bottom frame with width of screen.
|
// Find bottom frame with width of screen.
|
||||||
frp = lastwin_nofloating()->w_frame;
|
frp = lastwin_nofloating()->w_frame;
|
||||||
while (frp->fr_width != Columns && frp->fr_parent != NULL) {
|
while (frp->fr_width != Columns && frp->fr_parent != NULL) {
|
||||||
|
@ -394,7 +394,7 @@ describe('global statusline', function()
|
|||||||
meths.input_mouse('left', 'drag', '', 0, 14, 10)
|
meths.input_mouse('left', 'drag', '', 0, 14, 10)
|
||||||
eq(1, meths.get_option('cmdheight'))
|
eq(1, meths.get_option('cmdheight'))
|
||||||
meths.input_mouse('left', 'drag', '', 0, 15, 10)
|
meths.input_mouse('left', 'drag', '', 0, 15, 10)
|
||||||
eq(0, meths.get_option('cmdheight'))
|
eq(1, meths.get_option('cmdheight'))
|
||||||
meths.input_mouse('left', 'drag', '', 0, 14, 10)
|
meths.input_mouse('left', 'drag', '', 0, 14, 10)
|
||||||
eq(1, meths.get_option('cmdheight'))
|
eq(1, meths.get_option('cmdheight'))
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user