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