@@ -66,6 +66,11 @@ static void clear_snapshot_rec __ARGS((frame_T *fr));
6666static int check_snapshot_rec __ARGS ((frame_T * sn , frame_T * fr ));
6767static win_T * restore_snapshot_rec __ARGS ((frame_T * sn , frame_T * fr ));
6868
69+ static int frame_check_height __ARGS ((frame_T * topfrp , int height ));
70+ #ifdef FEAT_VERTSPLIT
71+ static int frame_check_width __ARGS ((frame_T * topfrp , int width ));
72+ #endif
73+
6974#endif /* FEAT_WINDOWS */
7075
7176static win_T * win_alloc __ARGS ((win_T * after , int hidden ));
@@ -4749,7 +4754,7 @@ shell_new_rows()
47494754 /* First try setting the heights of windows with 'winfixheight'. If
47504755 * that doesn't result in the right height, forget about that option. */
47514756 frame_new_height (topframe , h , FALSE, TRUE);
4752- if (topframe -> fr_height != h )
4757+ if (! frame_check_height ( topframe , h ) )
47534758 frame_new_height (topframe , h , FALSE, FALSE);
47544759
47554760 (void )win_comp_pos (); /* recompute w_winrow and w_wincol */
@@ -4783,7 +4788,7 @@ shell_new_columns()
47834788 /* First try setting the widths of windows with 'winfixwidth'. If that
47844789 * doesn't result in the right width, forget about that option. */
47854790 frame_new_width (topframe , (int )Columns , FALSE, TRUE);
4786- if (topframe -> fr_width != Columns )
4791+ if (! frame_check_width ( topframe , Columns ) )
47874792 frame_new_width (topframe , (int )Columns , FALSE, FALSE);
47884793
47894794 (void )win_comp_pos (); /* recompute w_winrow and w_wincol */
@@ -6922,3 +6927,48 @@ get_tab_number(tabpage_T *tp UNUSED)
69226927 return i ;
69236928}
69246929#endif
6930+
6931+ /*
6932+ * Return TRUE if "topfrp" and its children are at the right height.
6933+ */
6934+ static int
6935+ frame_check_height (topfrp , height )
6936+ frame_T * topfrp ;
6937+ int height ;
6938+ {
6939+ frame_T * frp ;
6940+
6941+ if (topfrp -> fr_height != height )
6942+ return FALSE;
6943+
6944+ if (topfrp -> fr_layout == FR_ROW )
6945+ for (frp = topfrp -> fr_child ; frp != NULL ; frp = frp -> fr_next )
6946+ if (frp -> fr_height != height )
6947+ return FALSE;
6948+
6949+ return TRUE;
6950+ }
6951+
6952+ #ifdef FEAT_VERTSPLIT
6953+ /*
6954+ * Return TRUE if "topfrp" and its children are at the right width.
6955+ */
6956+ static int
6957+ frame_check_width (topfrp , width )
6958+ frame_T * topfrp ;
6959+ int width ;
6960+ {
6961+ frame_T * frp ;
6962+
6963+ if (topfrp -> fr_width != width )
6964+ return FALSE;
6965+
6966+ if (topfrp -> fr_layout == FR_COL )
6967+ for (frp = topfrp -> fr_child ; frp != NULL ; frp = frp -> fr_next )
6968+ if (frp -> fr_width != width )
6969+ return FALSE;
6970+
6971+ return TRUE;
6972+ }
6973+ #endif
6974+
0 commit comments