073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.372
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.372
073263
Problem:    When 'winminheight' is zero there might not be one line for the
073263
	    current window.
073263
Solution:   Change the size computations. (Yukihiro Nakadaira)
073263
Files:	    src/window.c
073263
073263
073263
*** ../vim-7.4.371/src/window.c	2014-07-16 16:30:21.647608710 +0200
073263
--- src/window.c	2014-07-16 18:06:53.123491001 +0200
073263
***************
073263
*** 688,693 ****
073263
--- 688,695 ----
073263
      int		before;
073263
      int		minwidth;
073263
      int		minheight;
073263
+     int		wmw1;
073263
+     int		wmh1;
073263
  
073263
      if (flags & WSP_TOP)
073263
  	oldwin = firstwin;
073263
***************
073263
*** 722,740 ****
073263
  	 * Check if we are able to split the current window and compute its
073263
  	 * width.
073263
  	 */
073263
! 	needed = p_wmw + 1;
073263
  	if (flags & WSP_ROOM)
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
--- 724,745 ----
073263
  	 * Check if we are able to split the current window and compute its
073263
  	 * width.
073263
  	 */
073263
! 	/* Current window requires at least 1 space. */
073263
! 	wmw1 = (p_wmw == 0 ? 1 : p_wmw);
073263
! 	needed = wmw1 + 1;
073263
  	if (flags & WSP_ROOM)
073263
! 	    needed += p_wiw - wmw1;
073263
  	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
073263
  	{
073263
! 	    minwidth = frame_minwidth(topframe, NOWIN);
073263
  	    available = topframe->fr_width;
073263
  	    needed += minwidth;
073263
  	}
073263
  	else
073263
  	{
073263
! 	    minwidth = frame_minwidth(oldwin->w_frame, NOWIN);
073263
! 	    available = oldwin->w_frame->fr_width;
073263
! 	    needed += minwidth;
073263
  	}
073263
  	if (available < needed && new_wp == NULL)
073263
  	{
073263
***************
073263
*** 743,754 ****
073263
  	}
073263
  	if (new_size == 0)
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
  	/* if it doesn't fit in the current window, need win_equal() */
073263
  	if (oldwin->w_width - new_size - 1 < p_wmw)
073263
--- 748,757 ----
073263
  	}
073263
  	if (new_size == 0)
073263
  	    new_size = oldwin->w_width / 2;
073263
  	if (new_size > available - minwidth - 1)
073263
  	    new_size = available - minwidth - 1;
073263
! 	if (new_size < wmw1)
073263
! 	    new_size = wmw1;
073263
  
073263
  	/* if it doesn't fit in the current window, need win_equal() */
073263
  	if (oldwin->w_width - new_size - 1 < p_wmw)
073263
***************
073263
*** 789,808 ****
073263
  	 * Check if we are able to split the current window and compute its
073263
  	 * height.
073263
  	 */
073263
! 	needed = p_wmh + STATUS_HEIGHT + need_status;
073263
  	if (flags & WSP_ROOM)
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
  	if (available < needed && new_wp == NULL)
073263
  	{
073263
--- 792,813 ----
073263
  	 * Check if we are able to split the current window and compute its
073263
  	 * height.
073263
  	 */
073263
! 	/* Current window requires at least 1 space. */
073263
! 	wmh1 = (p_wmh == 0 ? 1 : p_wmh);
073263
! 	needed = wmh1 + STATUS_HEIGHT;
073263
  	if (flags & WSP_ROOM)
073263
! 	    needed += p_wh - wmh1;
073263
  	if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
073263
  	{
073263
! 	    minheight = frame_minheight(topframe, NOWIN) + need_status;
073263
  	    available = topframe->fr_height;
073263
  	    needed += minheight;
073263
  	}
073263
  	else
073263
  	{
073263
! 	    minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;
073263
! 	    available = oldwin->w_frame->fr_height;
073263
! 	    needed += minheight;
073263
  	}
073263
  	if (available < needed && new_wp == NULL)
073263
  	{
073263
***************
073263
*** 817,829 ****
073263
  	}
073263
  	if (new_size == 0)
073263
  	    new_size = oldwin_height / 2;
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
  	/* if it doesn't fit in the current window, need win_equal() */
073263
  	if (oldwin_height - new_size - STATUS_HEIGHT < p_wmh)
073263
--- 822,831 ----
073263
  	}
073263
  	if (new_size == 0)
073263
  	    new_size = oldwin_height / 2;
073263
  	if (new_size > available - minheight - STATUS_HEIGHT)
073263
  	    new_size = available - minheight - STATUS_HEIGHT;
073263
! 	if (new_size < wmh1)
073263
! 	    new_size = wmh1;
073263
  
073263
  	/* if it doesn't fit in the current window, need win_equal() */
073263
  	if (oldwin_height - new_size - STATUS_HEIGHT < p_wmh)
073263
*** ../vim-7.4.371/src/version.c	2014-07-16 17:29:46.691536252 +0200
073263
--- src/version.c	2014-07-16 17:34:14.795530803 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     372,
073263
  /**/
073263
073263
-- 
073263
   [The rest of the ARMY stand around looking at a loss.]
073263
INSPECTOR END OF FILM: (picks up megaphone) All right!  Clear off!  Go on!
073263
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
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    ///