summaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/window.c b/src/window.c
index 6be736945b..15a4d505e4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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;
}