99b86a7
To: vim-dev@vim.org
99b86a7
Subject: patch 7.1.060
99b86a7
Fcc: outbox
99b86a7
From: Bram Moolenaar <Bram@moolenaar.net>
99b86a7
Mime-Version: 1.0
99b86a7
Content-Type: text/plain; charset=ISO-8859-1
99b86a7
Content-Transfer-Encoding: 8bit
99b86a7
------------
99b86a7
99b86a7
Patch 7.1.060
99b86a7
Problem:    Splitting quickfix window messes up window layout. (Marius
99b86a7
	    Gedminas)
99b86a7
Solution:   Compute the window size in a smarter way. (Martin Toft)
99b86a7
Files:	    src/window.c
99b86a7
99b86a7
99b86a7
*** ../vim-7.1.059/src/window.c	Sun Aug  5 18:49:07 2007
99b86a7
--- src/window.c	Sun Aug  5 17:17:51 2007
99b86a7
***************
99b86a7
*** 2121,2127 ****
99b86a7
  	if (wp->w_p_pvw || bt_quickfix(wp->w_buffer))
99b86a7
  	{
99b86a7
  	    /*
99b86a7
! 	     * The cursor goes to the preview or the quickfix window, try
99b86a7
  	     * finding another window to go to.
99b86a7
  	     */
99b86a7
  	    for (;;)
99b86a7
--- 2121,2127 ----
99b86a7
  	if (wp->w_p_pvw || bt_quickfix(wp->w_buffer))
99b86a7
  	{
99b86a7
  	    /*
99b86a7
! 	     * If the cursor goes to the preview or the quickfix window, try
99b86a7
  	     * finding another window to go to.
99b86a7
  	     */
99b86a7
  	    for (;;)
99b86a7
***************
99b86a7
*** 2308,2314 ****
99b86a7
      frame_T	*frp, *frp2, *frp3;
99b86a7
      frame_T	*frp_close = win->w_frame;
99b86a7
      win_T	*wp;
99b86a7
-     int		old_size = 0;
99b86a7
  
99b86a7
      /*
99b86a7
       * If there is only one window there is nothing to remove.
99b86a7
--- 2308,2313 ----
99b86a7
***************
99b86a7
*** 2329,2361 ****
99b86a7
      if (frp_close->fr_parent->fr_layout == FR_COL)
99b86a7
      {
99b86a7
  #endif
99b86a7
! 	/* When 'winfixheight' is set, remember its old size and restore
99b86a7
! 	 * it later (it's a simplistic solution...).  Don't do this if the
99b86a7
! 	 * window will occupy the full height of the screen. */
99b86a7
! 	if (frp2->fr_win != NULL
99b86a7
! 		&& (frp2->fr_next != NULL || frp2->fr_prev != NULL)
99b86a7
! 		&& frp2->fr_win->w_p_wfh)
99b86a7
! 	    old_size = frp2->fr_win->w_height;
99b86a7
  	frame_new_height(frp2, frp2->fr_height + frp_close->fr_height,
99b86a7
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
99b86a7
- 	if (old_size != 0)
99b86a7
- 	    win_setheight_win(old_size, frp2->fr_win);
99b86a7
  #ifdef FEAT_VERTSPLIT
99b86a7
  	*dirp = 'v';
99b86a7
      }
99b86a7
      else
99b86a7
      {
99b86a7
! 	/* When 'winfixwidth' is set, remember its old size and restore
99b86a7
! 	 * it later (it's a simplistic solution...).  Don't do this if the
99b86a7
! 	 * window will occupy the full width of the screen. */
99b86a7
! 	if (frp2->fr_win != NULL
99b86a7
! 		&& (frp2->fr_next != NULL || frp2->fr_prev != NULL)
99b86a7
! 		&& frp2->fr_win->w_p_wfw)
99b86a7
! 	    old_size = frp2->fr_win->w_width;
99b86a7
  	frame_new_width(frp2, frp2->fr_width + frp_close->fr_width,
99b86a7
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
99b86a7
- 	if (old_size != 0)
99b86a7
- 	    win_setwidth_win(old_size, frp2->fr_win);
99b86a7
  	*dirp = 'h';
99b86a7
      }
99b86a7
  #endif
99b86a7
--- 2328,2404 ----
99b86a7
      if (frp_close->fr_parent->fr_layout == FR_COL)
99b86a7
      {
99b86a7
  #endif
99b86a7
! 	/* When 'winfixheight' is set, try to find another frame in the column
99b86a7
! 	 * (as close to the closed frame as possible) to distribute the height
99b86a7
! 	 * to. */
99b86a7
! 	if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfh)
99b86a7
! 	{
99b86a7
! 	    frp = frp_close->fr_prev;
99b86a7
! 	    frp3 = frp_close->fr_next;
99b86a7
! 	    while (frp != NULL || frp3 != NULL)
99b86a7
! 	    {
99b86a7
! 		if (frp != NULL)
99b86a7
! 		{
99b86a7
! 		    if (frp->fr_win != NULL && !frp->fr_win->w_p_wfh)
99b86a7
! 		    {
99b86a7
! 			frp2 = frp;
99b86a7
! 			wp = frp->fr_win;
99b86a7
! 			break;
99b86a7
! 		    }
99b86a7
! 		    frp = frp->fr_prev;
99b86a7
! 		}
99b86a7
! 		if (frp3 != NULL)
99b86a7
! 		{
99b86a7
! 		    if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfh)
99b86a7
! 		    {
99b86a7
! 			frp2 = frp3;
99b86a7
! 			wp = frp3->fr_win;
99b86a7
! 			break;
99b86a7
! 		    }
99b86a7
! 		    frp3 = frp3->fr_next;
99b86a7
! 		}
99b86a7
! 	    }
99b86a7
! 	}
99b86a7
  	frame_new_height(frp2, frp2->fr_height + frp_close->fr_height,
99b86a7
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
99b86a7
  #ifdef FEAT_VERTSPLIT
99b86a7
  	*dirp = 'v';
99b86a7
      }
99b86a7
      else
99b86a7
      {
99b86a7
! 	/* When 'winfixwidth' is set, try to find another frame in the column
99b86a7
! 	 * (as close to the closed frame as possible) to distribute the width
99b86a7
! 	 * to. */
99b86a7
! 	if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfw)
99b86a7
! 	{
99b86a7
! 	    frp = frp_close->fr_prev;
99b86a7
! 	    frp3 = frp_close->fr_next;
99b86a7
! 	    while (frp != NULL || frp3 != NULL)
99b86a7
! 	    {
99b86a7
! 		if (frp != NULL)
99b86a7
! 		{
99b86a7
! 		    if (frp->fr_win != NULL && !frp->fr_win->w_p_wfw)
99b86a7
! 		    {
99b86a7
! 			frp2 = frp;
99b86a7
! 			wp = frp->fr_win;
99b86a7
! 			break;
99b86a7
! 		    }
99b86a7
! 		    frp = frp->fr_prev;
99b86a7
! 		}
99b86a7
! 		if (frp3 != NULL)
99b86a7
! 		{
99b86a7
! 		    if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfw)
99b86a7
! 		    {
99b86a7
! 			frp2 = frp3;
99b86a7
! 			wp = frp3->fr_win;
99b86a7
! 			break;
99b86a7
! 		    }
99b86a7
! 		    frp3 = frp3->fr_next;
99b86a7
! 		}
99b86a7
! 	    }
99b86a7
! 	}
99b86a7
  	frame_new_width(frp2, frp2->fr_width + frp_close->fr_width,
99b86a7
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
99b86a7
  	*dirp = 'h';
99b86a7
      }
99b86a7
  #endif
99b86a7
*** ../vim-7.1.059/src/version.c	Fri Aug 10 21:32:41 2007
99b86a7
--- src/version.c	Sat Aug 11 13:34:42 2007
99b86a7
***************
99b86a7
*** 668,669 ****
99b86a7
--- 668,671 ----
99b86a7
  {   /* Add new patch number below this line */
99b86a7
+ /**/
99b86a7
+     60,
99b86a7
  /**/
99b86a7
99b86a7
-- 
99b86a7
hundred-and-one symptoms of being an internet addict:
99b86a7
117. You are more comfortable typing in html.
99b86a7
99b86a7
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
99b86a7
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
99b86a7
\\\        download, build and distribute -- http://www.A-A-P.org        ///
99b86a7
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///