summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-07-16 14:16:46 +0200
committerBram Moolenaar <Bram@vim.org>2014-07-16 14:16:46 +0200
commitb4d213551848414c29eb8d84394c1297a080e7a0 (patch)
tree28ae614e9d4e96fd8676c1d123af10a392b57ad9
parentdb6ea063352ec1c88c7bc0839fa2bf75bae56cf0 (diff)
downloadvim-git-b4d213551848414c29eb8d84394c1297a080e7a0.tar.gz
updated for version 7.4.365v7.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)
-rw-r--r--src/version.c2
-rw-r--r--src/window.c20
2 files changed, 18 insertions, 4 deletions
diff --git a/src/version.c b/src/version.c
index 0bfd039de..50ba9d204 100644
--- 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,
diff --git a/src/window.c b/src/window.c
index 81064518c..482692ffc 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);
}
}