0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.0.0114: the command line takes up space even when not used

Problem:    The command line takes up space even when not used.
Solution:   Allow for 'cmdheight' to be set to zero. (Shougo Matsushita,
            closes #10675, closes #940)
This commit is contained in:
Shougo Matsushita
2022-07-30 16:54:05 +01:00
committed by Bram Moolenaar
parent d90f91fe30
commit f39cfb7262
16 changed files with 154 additions and 30 deletions

View File

@@ -1005,6 +1005,8 @@ win_split_ins(
needed = wmh1 + STATUS_HEIGHT;
if (flags & WSP_ROOM)
needed += p_wh - wmh1;
if (p_ch == 0)
needed += 1; // Adjust for cmdheight=0.
if (flags & (WSP_BOT | WSP_TOP))
{
minheight = frame_minheight(topframe, NOWIN) + need_status;
@@ -5668,6 +5670,8 @@ win_setheight_win(int height, win_T *win)
if (full_screen && msg_scrolled == 0 && row < cmdline_row)
screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
cmdline_row = row;
p_ch = MAX(Rows - cmdline_row, 0);
curtab->tp_ch_used = p_ch;
msg_row = row;
msg_col = 0;
@@ -5704,9 +5708,12 @@ frame_setheight(frame_T *curfrp, int height)
if (curfrp->fr_parent == NULL)
{
// topframe: can only change the command line
if (height > ROWS_AVAIL)
height = ROWS_AVAIL;
// If height is greater than the available space, try to create
// space for the frame by reducing 'cmdheight' if possible, while
// making sure `cmdheight` doesn't go below 1.
height = MIN((p_ch > 0 ? ROWS_AVAIL + (p_ch - 1)
: ROWS_AVAIL), height);
if (height > 0)
frame_new_height(curfrp, height, FALSE, FALSE);
}
@@ -6037,7 +6044,7 @@ win_setminheight(void)
while (p_wmh > 0)
{
room = Rows - p_ch;
needed = min_rows() - 1; // 1 was added for the cmdline
needed = min_rows();
if (room >= needed)
break;
--p_wmh;
@@ -6143,9 +6150,7 @@ win_drag_status_line(win_T *dragwin, int offset)
* Only dragging the last status line can reduce p_ch.
*/
room = Rows - cmdline_row;
if (curfr->fr_next == NULL)
room -= 1;
else
if (curfr->fr_next != NULL)
room -= p_ch;
if (room < 0)
room = 0;
@@ -6196,9 +6201,7 @@ win_drag_status_line(win_T *dragwin, int offset)
row = win_comp_pos();
screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
cmdline_row = row;
p_ch = Rows - cmdline_row;
if (p_ch < 1)
p_ch = 1;
p_ch = MAX(Rows - cmdline_row, 0);
curtab->tp_ch_used = p_ch;
redraw_all_later(SOME_VALID);
showmode();
@@ -6733,7 +6736,8 @@ min_rows(void)
total = n;
}
total += tabline_height();
total += 1; // count the room for the command line
if (p_ch > 0)
total += 1; // count the room for the command line
return total;
}