diff options
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/src/window.c b/src/window.c index 74e3c04698..4f4f08b675 100644 --- a/src/window.c +++ b/src/window.c @@ -5430,23 +5430,21 @@ frame_setwidth(frame_T *curfrp, int width) } /* - * Check 'winminheight' for a valid value. + * Check 'winminheight' for a valid value and reduce it if needed. */ void win_setminheight(void) { int room; + int needed; int first = TRUE; - win_T *wp; - /* loop until there is a 'winminheight' that is possible */ + // loop until there is a 'winminheight' that is possible while (p_wmh > 0) { - /* TODO: handle vertical splits */ - room = -p_wh; - FOR_ALL_WINDOWS(wp) - room += VISIBLE_HEIGHT(wp) - p_wmh; - if (room >= 0) + room = Rows - p_ch; + needed = frame_minheight(topframe, NULL); + if (room >= needed) break; --p_wmh; if (first) @@ -5457,6 +5455,32 @@ win_setminheight(void) } } +/* + * Check 'winminwidth' for a valid value and reduce it if needed. + */ + void +win_setminwidth(void) +{ + int room; + int needed; + int first = TRUE; + + // loop until there is a 'winminheight' that is possible + while (p_wmw > 0) + { + room = Columns; + needed = frame_minwidth(topframe, NULL); + if (room >= needed) + break; + --p_wmw; + if (first) + { + EMSG(_(e_noroom)); + first = FALSE; + } + } +} + #if defined(FEAT_MOUSE) || defined(PROTO) /* |