aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 9b9a2126ff..9ac027d80f 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5560,9 +5560,10 @@ static void frame_setheight(frame_T *curfrp, int height)
if (curfrp->fr_parent == NULL) {
// topframe: can only change the command line
if (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(ROWS_AVAIL + (p_ch - 1), height);
+ // 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);