Mercurial > vim
changeset 6052:4625fa27ba6f v7.4.365
updated for version 7.4.365
Problem: Crash when using ":botright split" when there isn't much space.
Solution: Add a check for the minimum width/height. (Yukihiro Nakadaira)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 16 Jul 2014 14:16:46 +0200 |
parents | 0efec12f52ac |
children | 2434c319ad8b |
files | src/version.c src/window.c |
diffstat | 2 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 365, +/**/ 364, /**/ 363,
--- 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); } }