changeset 6077:255561411d7a v7.4.377

updated for version 7.4.377 Problem: When 'equalalways' is set a split may report "no room" even though there is plenty of room. Solution: Compute the available room properly. (Yukihiro Nakadaira)
author Bram Moolenaar <bram@vim.org>
date Wed, 23 Jul 2014 15:21:20 +0200
parents 827611a8802f
children caa758baebdf
files src/version.c src/window.c
diffstat 2 files changed, 39 insertions(+), 3 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 */
 /**/
+    377,
+/**/
     376,
 /**/
     375,
--- a/src/window.c
+++ b/src/window.c
@@ -684,7 +684,7 @@ win_split_ins(size, flags, new_wp, dir)
     int		available;
     int		oldwin_height = 0;
     int		layout;
-    frame_T	*frp, *curfrp;
+    frame_T	*frp, *curfrp, *frp2, *prevfrp;
     int		before;
     int		minheight;
     int		wmh1;
@@ -730,12 +730,29 @@ win_split_ins(size, flags, new_wp, dir)
 	needed = wmw1 + 1;
 	if (flags & WSP_ROOM)
 	    needed += p_wiw - wmw1;
-	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
+	if (flags & (WSP_BOT | WSP_TOP))
 	{
 	    minwidth = frame_minwidth(topframe, NOWIN);
 	    available = topframe->fr_width;
 	    needed += minwidth;
 	}
+	else if (p_ea)
+	{
+	    minwidth = frame_minwidth(oldwin->w_frame, NOWIN);
+	    prevfrp = oldwin->w_frame;
+	    for (frp = oldwin->w_frame->fr_parent; frp != NULL;
+							frp = frp->fr_parent)
+	    {
+		if (frp->fr_layout == FR_ROW)
+		    for (frp2 = frp->fr_child; frp2 != NULL;
+							frp2 = frp2->fr_next)
+			if (frp2 != prevfrp)
+			    minwidth += frame_minwidth(frp2, NOWIN);
+		prevfrp = frp;
+	    }
+	    available = topframe->fr_width;
+	    needed += minwidth;
+	}
 	else
 	{
 	    minwidth = frame_minwidth(oldwin->w_frame, NOWIN);
@@ -798,12 +815,29 @@ win_split_ins(size, flags, new_wp, dir)
 	needed = wmh1 + STATUS_HEIGHT;
 	if (flags & WSP_ROOM)
 	    needed += p_wh - wmh1;
-	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
+	if (flags & (WSP_BOT | WSP_TOP))
 	{
 	    minheight = frame_minheight(topframe, NOWIN) + need_status;
 	    available = topframe->fr_height;
 	    needed += minheight;
 	}
+	else if (p_ea)
+	{
+	    minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;
+	    prevfrp = oldwin->w_frame;
+	    for (frp = oldwin->w_frame->fr_parent; frp != NULL;
+							frp = frp->fr_parent)
+	    {
+		if (frp->fr_layout == FR_COL)
+		    for (frp2 = frp->fr_child; frp2 != NULL;
+							frp2 = frp2->fr_next)
+			if (frp2 != prevfrp)
+			    minheight += frame_minheight(frp2, NOWIN);
+		prevfrp = frp;
+	    }
+	    available = topframe->fr_height;
+	    needed += minheight;
+	}
 	else
 	{
 	    minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;