diff options
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c index 81064518c1..482692ffc9 100644 --- a/src/window.c +++ b/src/window.c @@ -686,6 +686,8 @@ win_split_ins(size, flags, new_wp, dir) int layout; frame_T *frp, *curfrp; int before; + int minwidth; + int minheight; if (flags & WSP_TOP) oldwin = firstwin; @@ -725,11 +727,15 @@ win_split_ins(size, flags, new_wp, dir) needed += p_wiw - p_wmw; if (p_ea || (flags & (WSP_BOT | WSP_TOP))) { + minwidth = frame_minwidth(topframe, NULL); available = topframe->fr_width; - needed += frame_minwidth(topframe, NULL); + needed += minwidth; } else + { + minwidth = frame_minwidth(oldwin->w_frame, NULL); available = oldwin->w_width; + } if (available < needed && new_wp == NULL) { EMSG(_(e_noroom)); @@ -739,6 +745,8 @@ win_split_ins(size, flags, new_wp, dir) new_size = oldwin->w_width / 2; if (new_size > oldwin->w_width - p_wmw - 1) new_size = oldwin->w_width - p_wmw - 1; + if (new_size > available - minwidth - 1) + new_size = available - minwidth - 1; if (new_size < p_wmw) new_size = p_wmw; @@ -786,11 +794,13 @@ win_split_ins(size, flags, new_wp, dir) needed += p_wh - p_wmh; if (p_ea || (flags & (WSP_BOT | WSP_TOP))) { + minheight = frame_minheight(topframe, NULL); available = topframe->fr_height; - needed += frame_minheight(topframe, NULL); + needed += minheight; } else { + minheight = frame_minheight(oldwin->w_frame, NULL); available = oldwin->w_height; needed += p_wmh; } @@ -810,6 +820,8 @@ win_split_ins(size, flags, new_wp, dir) if (new_size > oldwin_height - p_wmh - STATUS_HEIGHT) new_size = oldwin_height - p_wmh - STATUS_HEIGHT; + if (new_size > available - minheight - STATUS_HEIGHT) + new_size = available - minheight - STATUS_HEIGHT; if (new_size < p_wmh) new_size = p_wmh; @@ -5732,7 +5744,7 @@ win_new_height(wp, height) --wp->w_wrow; } } - set_topline(wp, lnum); + set_topline(wp, lnum); } else if (sline > 0) { @@ -5778,7 +5790,7 @@ win_new_height(wp, height) wp->w_wrow -= sline; } - set_topline(wp, lnum); + set_topline(wp, lnum); } } |