diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-06-12 16:49:30 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-06-12 16:49:30 +0200 |
commit | 1c3c10492a291270fa89b3c8df11828792f927d3 (patch) | |
tree | e644f87ac8716b7d9232f4ebe2d8610350397d4c /src/window.c | |
parent | ae0f30b761eb62e1b6bfc83fb4a6d1a47bf48320 (diff) |
patch 8.1.0046: loading a session file fails if 'winheight' is bigv8.1.0046
Problem: Loading a session file fails if 'winheight' is a big number.
Solution: Set 'minwinheight' to zero at first. Don't give an error when
setting 'minwinheight' while 'winheight' is a big number.
Fix using vertical splits. Fix setting 'minwinwidth'.
(closes #2970)
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) /* |