To: vim-dev@vim.org
Subject: Patch 6.0.075
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 6.0.075
Problem:    When closing a horizontally split window while 'eadirection' is
	    "hor" another horizontally split window is still resized. (Aron
	    Griffis)
Solution:   Only resize windows in the same top frame as the window that is
	    split or closed.
Files:	    src/main.c, src/proto/window.pro, src/window.c


*** ../vim60.74/src/main.c	Thu Nov  1 12:22:41 2001
--- src/main.c	Mon Nov  5 09:29:34 2001
***************
*** 1716,1722 ****
  # endif
      TIME_MSG("editing files in windows");
      if (window_count > 1)
! 	win_equal(curwin, 'b');		/* adjust heights */
  #endif /* FEAT_WINDOWS */
  
  #ifdef FEAT_DIFF
--- 1716,1722 ----
  # endif
      TIME_MSG("editing files in windows");
      if (window_count > 1)
! 	win_equal(curwin, FALSE, 'b');	/* adjust heights */
  #endif /* FEAT_WINDOWS */
  
  #ifdef FEAT_DIFF
*** ../vim60.74/src/proto/window.pro	Tue Sep 25 21:49:27 2001
--- src/proto/window.pro	Mon Nov  5 09:29:09 2001
***************
*** 5,11 ****
  int win_count __ARGS((void));
  int make_windows __ARGS((int count, int vertical));
  void win_move_after __ARGS((win_T *win1, win_T *win2));
! void win_equal __ARGS((win_T *next_curwin, int dir));
  void close_windows __ARGS((buf_T *buf));
  void win_close __ARGS((win_T *win, int free_buf));
  void close_others __ARGS((int message, int forceit));
--- 5,11 ----
  int win_count __ARGS((void));
  int make_windows __ARGS((int count, int vertical));
  void win_move_after __ARGS((win_T *win1, win_T *win2));
! void win_equal __ARGS((win_T *next_curwin, int current, int dir));
  void close_windows __ARGS((buf_T *buf));
  void win_close __ARGS((win_T *win, int free_buf));
  void close_others __ARGS((int message, int forceit));
*** ../vim60.74/src/window.c	Thu Nov  1 14:51:27 2001
--- src/window.c	Mon Nov  5 09:49:44 2001
***************
*** 25,31 ****
  static void win_exchange __ARGS((long));
  static void win_rotate __ARGS((int, int));
  static void win_totop __ARGS((int size, int flags));
! static void win_equal_rec __ARGS((win_T *next_curwin, frame_T *topfr, int dir, int col, int row, int width, int height));
  static win_T *winframe_remove __ARGS((win_T *win, int *dirp));
  static frame_T *win_altframe __ARGS((win_T *win));
  static win_T *frame2win __ARGS((frame_T *frp));
--- 25,31 ----
  static void win_exchange __ARGS((long));
  static void win_rotate __ARGS((int, int));
  static void win_totop __ARGS((int size, int flags));
! static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height));
  static win_T *winframe_remove __ARGS((win_T *win, int *dirp));
  static frame_T *win_altframe __ARGS((win_T *win));
  static win_T *frame2win __ARGS((frame_T *frp));
***************
*** 367,373 ****
  #ifdef FEAT_GUI
  		need_mouse_correct = TRUE;
  #endif
! 		win_equal(NULL, 0);
  		break;
  
  /* increase current window height */
--- 367,373 ----
  #ifdef FEAT_GUI
  		need_mouse_correct = TRUE;
  #endif
! 		win_equal(NULL, FALSE, 0);
  		break;
  
  /* increase current window height */
***************
*** 1015,1021 ****
       * make the new window the current window and redraw
       */
      if (do_equal || dir != 0)
! 	win_equal(wp,
  #ifdef FEAT_VERTSPLIT
  		(flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h')
  		: dir == 'h' ? 'b' :
--- 1015,1021 ----
       * make the new window the current window and redraw
       */
      if (do_equal || dir != 0)
! 	win_equal(wp, TRUE,
  #ifdef FEAT_VERTSPLIT
  		(flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h')
  		: dir == 'h' ? 'b' :
***************
*** 1485,1492 ****
   * rows.
   */
      void
! win_equal(next_curwin, dir)
      win_T	*next_curwin;	/* pointer to current window to be or NULL */
      int		dir;		/* 'v' for vertically, 'h' for horizontally,
  				   'b' for both, 0 for using p_ead */
  {
--- 1485,1493 ----
   * rows.
   */
      void
! win_equal(next_curwin, current, dir)
      win_T	*next_curwin;	/* pointer to current window to be or NULL */
+     int		current;	/* do only frame with current window */
      int		dir;		/* 'v' for vertically, 'h' for horizontally,
  				   'b' for both, 0 for using p_ead */
  {
***************
*** 1496,1503 ****
  #else
  	dir = 'b';
  #endif
!     win_equal_rec(next_curwin == NULL ? curwin : next_curwin, topframe, dir,
! 				     0, 0, (int)Columns, topframe->fr_height);
  }
  
  /*
--- 1497,1504 ----
  #else
  	dir = 'b';
  #endif
!     win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current,
! 		      topframe, dir, 0, 0, (int)Columns, topframe->fr_height);
  }
  
  /*
***************
*** 1507,1514 ****
   * 'winheight' and 'winwidth' if possible.
   */
      static void
! win_equal_rec(next_curwin, topfr, dir, col, row, width, height)
      win_T	*next_curwin;	/* pointer to current window to be or NULL */
      frame_T	*topfr;		/* frame to set size off */
      int		dir;		/* 'v', 'h' or 'b', see win_equal() */
      int		col;		/* horizontal position for frame */
--- 1508,1516 ----
   * 'winheight' and 'winwidth' if possible.
   */
      static void
! win_equal_rec(next_curwin, current, topfr, dir, col, row, width, height)
      win_T	*next_curwin;	/* pointer to current window to be or NULL */
+     int		current;	/* do only frame with current window */
      frame_T	*topfr;		/* frame to set size off */
      int		dir;		/* 'v', 'h' or 'b', see win_equal() */
      int		col;		/* horizontal position for frame */
***************
*** 1616,1622 ****
  		    new_size += next_curwin_size;
  		}
  	    }
! 	    win_equal_rec(next_curwin, fr, dir, col, row, new_size + n, height);
  	    col += new_size + n;
  	    width -= new_size + n;
  	    if (n != m)	    /* contains curwin */
--- 1618,1631 ----
  		    new_size += next_curwin_size;
  		}
  	    }
! 
! 	    /* Skip frame that is full height when splitting or closing a
! 	     * window, unless equalizing all frames. */
! 	    if (!current || dir != 'v' || topfr->fr_parent != NULL
! 		    || (new_size != fr->fr_width)
! 		    || frame_has_win(fr, next_curwin))
! 		win_equal_rec(next_curwin, current, fr, dir, col, row,
! 							new_size + n, height);
  	    col += new_size + n;
  	    width -= new_size + n;
  	    if (n != m)	    /* contains curwin */
***************
*** 1766,1772 ****
  		    room -= new_size;
  		new_size += n;
  	    }
! 	    win_equal_rec(next_curwin, fr, dir, col, row, width, new_size);
  	    row += new_size;
  	    height -= new_size;
  	    totwincount -= wincount;
--- 1775,1787 ----
  		    room -= new_size;
  		new_size += n;
  	    }
! 	    /* Skip frame that is full width when splitting or closing a
! 	     * window, unless equalizing all frames. */
! 	    if (!current || dir != 'h' || topfr->fr_parent != NULL
! 		    || (new_size != fr->fr_height)
! 		    || frame_has_win(fr, next_curwin))
! 		win_equal_rec(next_curwin, current, fr, dir, col, row,
! 							     width, new_size);
  	    row += new_size;
  	    height -= new_size;
  	    totwincount -= wincount;
***************
*** 1906,1912 ****
  	close_curwin = TRUE;
      }
      if (p_ea)
! 	win_equal(curwin,
  #ifdef FEAT_VERTSPLIT
  		dir
  #else
--- 1921,1927 ----
  	close_curwin = TRUE;
      }
      if (p_ea)
! 	win_equal(curwin, TRUE,
  #ifdef FEAT_VERTSPLIT
  		dir
  #else
***************
*** 3199,3205 ****
  #if 0
      /* Disabled: don't want making the screen smaller make a window larger. */
      if (p_ea)
! 	win_equal(curwin, 'v');
  #endif
  }
  
--- 3214,3220 ----
  #if 0
      /* Disabled: don't want making the screen smaller make a window larger. */
      if (p_ea)
! 	win_equal(curwin, FALSE, 'v');
  #endif
  }
  
***************
*** 3217,3223 ****
  #if 0
      /* Disabled: don't want making the screen smaller make a window larger. */
      if (p_ea)
! 	win_equal(curwin, 'h');
  #endif
  }
  #endif
--- 3232,3238 ----
  #if 0
      /* Disabled: don't want making the screen smaller make a window larger. */
      if (p_ea)
! 	win_equal(curwin, FALSE, 'h');
  #endif
  }
  #endif
*** ../vim60.74/src/version.c	Mon Nov  5 09:00:25 2001
--- src/version.c	Mon Nov  5 09:41:37 2001
***************
*** 608,609 ****
--- 608,611 ----
  {   /* Add new patch number below this line */
+ /**/
+     75,
  /**/

-- 
Imagine a world without hypothetical situations.

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
(((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///