073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.365
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.365
073263
Problem:    Crash when using ":botright split" when there isn't much space.
073263
Solution:   Add a check for the minimum width/height. (Yukihiro Nakadaira)
073263
Files:	    src/window.c
073263
073263
073263
*** ../vim-7.4.364/src/window.c	2014-07-02 17:16:51.334225522 +0200
073263
--- src/window.c	2014-07-16 14:14:37.751774230 +0200
073263
***************
073263
*** 686,691 ****
073263
--- 686,693 ----
073263
      int		layout;
073263
      frame_T	*frp, *curfrp;
073263
      int		before;
073263
+     int		minwidth;
073263
+     int		minheight;
073263
  
073263
      if (flags & WSP_TOP)
073263
  	oldwin = firstwin;
073263
***************
073263
*** 725,735 ****
073263
  	    needed += p_wiw - p_wmw;
073263
  	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
073263
  	{
073263
  	    available = topframe->fr_width;
073263
! 	    needed += frame_minwidth(topframe, NULL);
073263
  	}
073263
  	else
073263
  	    available = oldwin->w_width;
073263
  	if (available < needed && new_wp == NULL)
073263
  	{
073263
  	    EMSG(_(e_noroom));
073263
--- 727,741 ----
073263
  	    needed += p_wiw - p_wmw;
073263
  	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
073263
  	{
073263
+ 	    minwidth = frame_minwidth(topframe, NULL);
073263
  	    available = topframe->fr_width;
073263
! 	    needed += minwidth;
073263
  	}
073263
  	else
073263
+ 	{
073263
+ 	    minwidth = frame_minwidth(oldwin->w_frame, NULL);
073263
  	    available = oldwin->w_width;
073263
+ 	}
073263
  	if (available < needed && new_wp == NULL)
073263
  	{
073263
  	    EMSG(_(e_noroom));
073263
***************
073263
*** 739,744 ****
073263
--- 745,752 ----
073263
  	    new_size = oldwin->w_width / 2;
073263
  	if (new_size > oldwin->w_width - p_wmw - 1)
073263
  	    new_size = oldwin->w_width - p_wmw - 1;
073263
+ 	if (new_size > available - minwidth - 1)
073263
+ 	    new_size = available - minwidth - 1;
073263
  	if (new_size < p_wmw)
073263
  	    new_size = p_wmw;
073263
  
073263
***************
073263
*** 786,796 ****
073263
  	    needed += p_wh - p_wmh;
073263
  	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
073263
  	{
073263
  	    available = topframe->fr_height;
073263
! 	    needed += frame_minheight(topframe, NULL);
073263
  	}
073263
  	else
073263
  	{
073263
  	    available = oldwin->w_height;
073263
  	    needed += p_wmh;
073263
  	}
073263
--- 794,806 ----
073263
  	    needed += p_wh - p_wmh;
073263
  	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
073263
  	{
073263
+ 	    minheight = frame_minheight(topframe, NULL);
073263
  	    available = topframe->fr_height;
073263
! 	    needed += minheight;
073263
  	}
073263
  	else
073263
  	{
073263
+ 	    minheight = frame_minheight(oldwin->w_frame, NULL);
073263
  	    available = oldwin->w_height;
073263
  	    needed += p_wmh;
073263
  	}
073263
***************
073263
*** 810,815 ****
073263
--- 820,827 ----
073263
  
073263
  	if (new_size > oldwin_height - p_wmh - STATUS_HEIGHT)
073263
  	    new_size = oldwin_height - p_wmh - STATUS_HEIGHT;
073263
+ 	if (new_size > available - minheight - STATUS_HEIGHT)
073263
+ 	    new_size = available - minheight - STATUS_HEIGHT;
073263
  	if (new_size < p_wmh)
073263
  	    new_size = p_wmh;
073263
  
073263
***************
073263
*** 5732,5738 ****
073263
  		    --wp->w_wrow;
073263
  		}
073263
  	    }
073263
!             set_topline(wp, lnum);
073263
  	}
073263
  	else if (sline > 0)
073263
  	{
073263
--- 5744,5750 ----
073263
  		    --wp->w_wrow;
073263
  		}
073263
  	    }
073263
! 	    set_topline(wp, lnum);
073263
  	}
073263
  	else if (sline > 0)
073263
  	{
073263
***************
073263
*** 5778,5784 ****
073263
  		wp->w_wrow -= sline;
073263
  	    }
073263
  
073263
!             set_topline(wp, lnum);
073263
  	}
073263
      }
073263
  
073263
--- 5790,5796 ----
073263
  		wp->w_wrow -= sline;
073263
  	    }
073263
  
073263
! 	    set_topline(wp, lnum);
073263
  	}
073263
      }
073263
  
073263
*** ../vim-7.4.364/src/version.c	2014-07-09 21:17:59.755550204 +0200
073263
--- src/version.c	2014-07-16 14:10:41.191779038 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     365,
073263
  /**/
073263
073263
-- 
073263
"Software is like sex... it's better when it's free."
073263
		-- Linus Torvalds, initiator of the free Linux OS
073263
Makes me wonder what FSF stands for...?
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///