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