Blob Blame History Raw
To: vim-dev@vim.org
Subject: patch 7.1.060
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.060
Problem:    Splitting quickfix window messes up window layout. (Marius
	    Gedminas)
Solution:   Compute the window size in a smarter way. (Martin Toft)
Files:	    src/window.c


*** ../vim-7.1.059/src/window.c	Sun Aug  5 18:49:07 2007
--- src/window.c	Sun Aug  5 17:17:51 2007
***************
*** 2121,2127 ****
  	if (wp->w_p_pvw || bt_quickfix(wp->w_buffer))
  	{
  	    /*
! 	     * The cursor goes to the preview or the quickfix window, try
  	     * finding another window to go to.
  	     */
  	    for (;;)
--- 2121,2127 ----
  	if (wp->w_p_pvw || bt_quickfix(wp->w_buffer))
  	{
  	    /*
! 	     * If the cursor goes to the preview or the quickfix window, try
  	     * finding another window to go to.
  	     */
  	    for (;;)
***************
*** 2308,2314 ****
      frame_T	*frp, *frp2, *frp3;
      frame_T	*frp_close = win->w_frame;
      win_T	*wp;
-     int		old_size = 0;
  
      /*
       * If there is only one window there is nothing to remove.
--- 2308,2313 ----
***************
*** 2329,2361 ****
      if (frp_close->fr_parent->fr_layout == FR_COL)
      {
  #endif
! 	/* When 'winfixheight' is set, remember its old size and restore
! 	 * it later (it's a simplistic solution...).  Don't do this if the
! 	 * window will occupy the full height of the screen. */
! 	if (frp2->fr_win != NULL
! 		&& (frp2->fr_next != NULL || frp2->fr_prev != NULL)
! 		&& frp2->fr_win->w_p_wfh)
! 	    old_size = frp2->fr_win->w_height;
  	frame_new_height(frp2, frp2->fr_height + frp_close->fr_height,
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
- 	if (old_size != 0)
- 	    win_setheight_win(old_size, frp2->fr_win);
  #ifdef FEAT_VERTSPLIT
  	*dirp = 'v';
      }
      else
      {
! 	/* When 'winfixwidth' is set, remember its old size and restore
! 	 * it later (it's a simplistic solution...).  Don't do this if the
! 	 * window will occupy the full width of the screen. */
! 	if (frp2->fr_win != NULL
! 		&& (frp2->fr_next != NULL || frp2->fr_prev != NULL)
! 		&& frp2->fr_win->w_p_wfw)
! 	    old_size = frp2->fr_win->w_width;
  	frame_new_width(frp2, frp2->fr_width + frp_close->fr_width,
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
- 	if (old_size != 0)
- 	    win_setwidth_win(old_size, frp2->fr_win);
  	*dirp = 'h';
      }
  #endif
--- 2328,2404 ----
      if (frp_close->fr_parent->fr_layout == FR_COL)
      {
  #endif
! 	/* When 'winfixheight' is set, try to find another frame in the column
! 	 * (as close to the closed frame as possible) to distribute the height
! 	 * to. */
! 	if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfh)
! 	{
! 	    frp = frp_close->fr_prev;
! 	    frp3 = frp_close->fr_next;
! 	    while (frp != NULL || frp3 != NULL)
! 	    {
! 		if (frp != NULL)
! 		{
! 		    if (frp->fr_win != NULL && !frp->fr_win->w_p_wfh)
! 		    {
! 			frp2 = frp;
! 			wp = frp->fr_win;
! 			break;
! 		    }
! 		    frp = frp->fr_prev;
! 		}
! 		if (frp3 != NULL)
! 		{
! 		    if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfh)
! 		    {
! 			frp2 = frp3;
! 			wp = frp3->fr_win;
! 			break;
! 		    }
! 		    frp3 = frp3->fr_next;
! 		}
! 	    }
! 	}
  	frame_new_height(frp2, frp2->fr_height + frp_close->fr_height,
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
  #ifdef FEAT_VERTSPLIT
  	*dirp = 'v';
      }
      else
      {
! 	/* When 'winfixwidth' is set, try to find another frame in the column
! 	 * (as close to the closed frame as possible) to distribute the width
! 	 * to. */
! 	if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfw)
! 	{
! 	    frp = frp_close->fr_prev;
! 	    frp3 = frp_close->fr_next;
! 	    while (frp != NULL || frp3 != NULL)
! 	    {
! 		if (frp != NULL)
! 		{
! 		    if (frp->fr_win != NULL && !frp->fr_win->w_p_wfw)
! 		    {
! 			frp2 = frp;
! 			wp = frp->fr_win;
! 			break;
! 		    }
! 		    frp = frp->fr_prev;
! 		}
! 		if (frp3 != NULL)
! 		{
! 		    if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfw)
! 		    {
! 			frp2 = frp3;
! 			wp = frp3->fr_win;
! 			break;
! 		    }
! 		    frp3 = frp3->fr_next;
! 		}
! 	    }
! 	}
  	frame_new_width(frp2, frp2->fr_width + frp_close->fr_width,
  			    frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
  	*dirp = 'h';
      }
  #endif
*** ../vim-7.1.059/src/version.c	Fri Aug 10 21:32:41 2007
--- src/version.c	Sat Aug 11 13:34:42 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     60,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
117. You are more comfortable typing in html.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///