Karsten Hopp 97b84a
To: vim_dev@googlegroups.com
Karsten Hopp 97b84a
Subject: Patch 7.3.1246
Karsten Hopp 97b84a
Fcc: outbox
Karsten Hopp 97b84a
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 97b84a
Mime-Version: 1.0
Karsten Hopp 97b84a
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 97b84a
Content-Transfer-Encoding: 8bit
Karsten Hopp 97b84a
------------
Karsten Hopp 97b84a
Karsten Hopp 97b84a
Patch 7.3.1246
Karsten Hopp 97b84a
Problem:    When setting 'winfixheight' and resizing the window causes the
Karsten Hopp 97b84a
	    window layout to be wrong.
Karsten Hopp 97b84a
Solution:   Add frame_check_height() and frame_check_width() (Yukihiro
Karsten Hopp 97b84a
	    Nakadaira)
Karsten Hopp 97b84a
Files:	    src/window.c
Karsten Hopp 97b84a
Karsten Hopp 97b84a
Karsten Hopp 97b84a
*** ../vim-7.3.1245/src/window.c	2013-06-16 17:32:33.000000000 +0200
Karsten Hopp 97b84a
--- src/window.c	2013-06-26 13:51:25.000000000 +0200
Karsten Hopp 97b84a
***************
Karsten Hopp 97b84a
*** 66,71 ****
Karsten Hopp 97b84a
--- 66,76 ----
Karsten Hopp 97b84a
  static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
Karsten Hopp 97b84a
  static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
Karsten Hopp 97b84a
  
Karsten Hopp 97b84a
+ static int frame_check_height __ARGS((frame_T *topfrp, int height));
Karsten Hopp 97b84a
+ #ifdef FEAT_VERTSPLIT
Karsten Hopp 97b84a
+ static int frame_check_width __ARGS((frame_T *topfrp, int width));
Karsten Hopp 97b84a
+ #endif
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
  #endif /* FEAT_WINDOWS */
Karsten Hopp 97b84a
  
Karsten Hopp 97b84a
  static win_T *win_alloc __ARGS((win_T *after, int hidden));
Karsten Hopp 97b84a
***************
Karsten Hopp 97b84a
*** 4749,4755 ****
Karsten Hopp 97b84a
      /* First try setting the heights of windows with 'winfixheight'.  If
Karsten Hopp 97b84a
       * that doesn't result in the right height, forget about that option. */
Karsten Hopp 97b84a
      frame_new_height(topframe, h, FALSE, TRUE);
Karsten Hopp 97b84a
!     if (topframe->fr_height != h)
Karsten Hopp 97b84a
  	frame_new_height(topframe, h, FALSE, FALSE);
Karsten Hopp 97b84a
  
Karsten Hopp 97b84a
      (void)win_comp_pos();		/* recompute w_winrow and w_wincol */
Karsten Hopp 97b84a
--- 4754,4760 ----
Karsten Hopp 97b84a
      /* First try setting the heights of windows with 'winfixheight'.  If
Karsten Hopp 97b84a
       * that doesn't result in the right height, forget about that option. */
Karsten Hopp 97b84a
      frame_new_height(topframe, h, FALSE, TRUE);
Karsten Hopp 97b84a
!     if (!frame_check_height(topframe, h))
Karsten Hopp 97b84a
  	frame_new_height(topframe, h, FALSE, FALSE);
Karsten Hopp 97b84a
  
Karsten Hopp 97b84a
      (void)win_comp_pos();		/* recompute w_winrow and w_wincol */
Karsten Hopp 97b84a
***************
Karsten Hopp 97b84a
*** 4783,4789 ****
Karsten Hopp 97b84a
      /* First try setting the widths of windows with 'winfixwidth'.  If that
Karsten Hopp 97b84a
       * doesn't result in the right width, forget about that option. */
Karsten Hopp 97b84a
      frame_new_width(topframe, (int)Columns, FALSE, TRUE);
Karsten Hopp 97b84a
!     if (topframe->fr_width != Columns)
Karsten Hopp 97b84a
  	frame_new_width(topframe, (int)Columns, FALSE, FALSE);
Karsten Hopp 97b84a
  
Karsten Hopp 97b84a
      (void)win_comp_pos();		/* recompute w_winrow and w_wincol */
Karsten Hopp 97b84a
--- 4788,4794 ----
Karsten Hopp 97b84a
      /* First try setting the widths of windows with 'winfixwidth'.  If that
Karsten Hopp 97b84a
       * doesn't result in the right width, forget about that option. */
Karsten Hopp 97b84a
      frame_new_width(topframe, (int)Columns, FALSE, TRUE);
Karsten Hopp 97b84a
!     if (!frame_check_width(topframe, Columns))
Karsten Hopp 97b84a
  	frame_new_width(topframe, (int)Columns, FALSE, FALSE);
Karsten Hopp 97b84a
  
Karsten Hopp 97b84a
      (void)win_comp_pos();		/* recompute w_winrow and w_wincol */
Karsten Hopp 97b84a
***************
Karsten Hopp 97b84a
*** 6922,6924 ****
Karsten Hopp 97b84a
--- 6927,6974 ----
Karsten Hopp 97b84a
  	return i;
Karsten Hopp 97b84a
  }
Karsten Hopp 97b84a
  #endif
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+ /*
Karsten Hopp 97b84a
+  * Return TRUE if "topfrp" and its children are at the right height.
Karsten Hopp 97b84a
+  */
Karsten Hopp 97b84a
+     static int
Karsten Hopp 97b84a
+ frame_check_height(topfrp, height)
Karsten Hopp 97b84a
+     frame_T *topfrp;
Karsten Hopp 97b84a
+     int	    height;
Karsten Hopp 97b84a
+ {
Karsten Hopp 97b84a
+     frame_T *frp;
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+     if (topfrp->fr_height != height)
Karsten Hopp 97b84a
+ 	return FALSE;
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+     if (topfrp->fr_layout == FR_ROW)
Karsten Hopp 97b84a
+ 	for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
Karsten Hopp 97b84a
+ 	    if (frp->fr_height != height)
Karsten Hopp 97b84a
+ 		return FALSE;
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+     return TRUE;
Karsten Hopp 97b84a
+ }
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+ #ifdef FEAT_VERTSPLIT
Karsten Hopp 97b84a
+ /*
Karsten Hopp 97b84a
+  * Return TRUE if "topfrp" and its children are at the right width.
Karsten Hopp 97b84a
+  */
Karsten Hopp 97b84a
+     static int
Karsten Hopp 97b84a
+ frame_check_width(topfrp, width)
Karsten Hopp 97b84a
+     frame_T *topfrp;
Karsten Hopp 97b84a
+     int	    width;
Karsten Hopp 97b84a
+ {
Karsten Hopp 97b84a
+     frame_T *frp;
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+     if (topfrp->fr_width != width)
Karsten Hopp 97b84a
+ 	return FALSE;
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+     if (topfrp->fr_layout == FR_COL)
Karsten Hopp 97b84a
+ 	for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
Karsten Hopp 97b84a
+ 	    if (frp->fr_width != width)
Karsten Hopp 97b84a
+ 		return FALSE;
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
+     return TRUE;
Karsten Hopp 97b84a
+ }
Karsten Hopp 97b84a
+ #endif
Karsten Hopp 97b84a
+ 
Karsten Hopp 97b84a
*** ../vim-7.3.1245/src/version.c	2013-06-26 13:16:13.000000000 +0200
Karsten Hopp 97b84a
--- src/version.c	2013-06-26 13:47:56.000000000 +0200
Karsten Hopp 97b84a
***************
Karsten Hopp 97b84a
*** 730,731 ****
Karsten Hopp 97b84a
--- 730,733 ----
Karsten Hopp 97b84a
  {   /* Add new patch number below this line */
Karsten Hopp 97b84a
+ /**/
Karsten Hopp 97b84a
+     1246,
Karsten Hopp 97b84a
  /**/
Karsten Hopp 97b84a
Karsten Hopp 97b84a
-- 
Karsten Hopp 97b84a
Back up my hard drive?  I can't find the reverse switch!
Karsten Hopp 97b84a
Karsten Hopp 97b84a
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 97b84a
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 97b84a
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 97b84a
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///