summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2013-06-26 14:04:47 +0200
committerBram Moolenaar <bram@vim.org>2013-06-26 14:04:47 +0200
commitdeebae8c8e056efe944ddfa01a231017ba6477e3 (patch)
tree8e835cabcadfe7d6d7a123b618e8aea5bb4eb4e4
parentb5f656bb01b9820bfced942815fa4edbfba4569a (diff)
downloadvim-deebae8c8e056efe944ddfa01a231017ba6477e3.tar.gz
updated for version 7.3.1246v7.3.1246v7-3-1246
Problem: When setting 'winfixheight' and resizing the window causes the window layout to be wrong. Solution: Add frame_check_height() and frame_check_width() (Yukihiro Nakadaira)
-rw-r--r--src/version.c2
-rw-r--r--src/window.c54
2 files changed, 54 insertions, 2 deletions
diff --git a/src/version.c b/src/version.c
index c06fad35..fb70ebc9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1246,
+/**/
1245,
/**/
1244,
diff --git a/src/window.c b/src/window.c
index 1ed3deca..d7d45e04 100644
--- a/src/window.c
+++ b/src/window.c
@@ -66,6 +66,11 @@ static void clear_snapshot_rec __ARGS((frame_T *fr));
static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
+static int frame_check_height __ARGS((frame_T *topfrp, int height));
+#ifdef FEAT_VERTSPLIT
+static int frame_check_width __ARGS((frame_T *topfrp, int width));
+#endif
+
#endif /* FEAT_WINDOWS */
static win_T *win_alloc __ARGS((win_T *after, int hidden));
@@ -4749,7 +4754,7 @@ shell_new_rows()
/* First try setting the heights of windows with 'winfixheight'. If
* that doesn't result in the right height, forget about that option. */
frame_new_height(topframe, h, FALSE, TRUE);
- if (topframe->fr_height != h)
+ if (!frame_check_height(topframe, h))
frame_new_height(topframe, h, FALSE, FALSE);
(void)win_comp_pos(); /* recompute w_winrow and w_wincol */
@@ -4783,7 +4788,7 @@ shell_new_columns()
/* First try setting the widths of windows with 'winfixwidth'. If that
* doesn't result in the right width, forget about that option. */
frame_new_width(topframe, (int)Columns, FALSE, TRUE);
- if (topframe->fr_width != Columns)
+ if (!frame_check_width(topframe, Columns))
frame_new_width(topframe, (int)Columns, FALSE, FALSE);
(void)win_comp_pos(); /* recompute w_winrow and w_wincol */
@@ -6922,3 +6927,48 @@ get_tab_number(tabpage_T *tp UNUSED)
return i;
}
#endif
+
+/*
+ * Return TRUE if "topfrp" and its children are at the right height.
+ */
+ static int
+frame_check_height(topfrp, height)
+ frame_T *topfrp;
+ int height;
+{
+ frame_T *frp;
+
+ if (topfrp->fr_height != height)
+ return FALSE;
+
+ if (topfrp->fr_layout == FR_ROW)
+ for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
+ if (frp->fr_height != height)
+ return FALSE;
+
+ return TRUE;
+}
+
+#ifdef FEAT_VERTSPLIT
+/*
+ * Return TRUE if "topfrp" and its children are at the right width.
+ */
+ static int
+frame_check_width(topfrp, width)
+ frame_T *topfrp;
+ int width;
+{
+ frame_T *frp;
+
+ if (topfrp->fr_width != width)
+ return FALSE;
+
+ if (topfrp->fr_layout == FR_COL)
+ for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
+ if (frp->fr_width != width)
+ return FALSE;
+
+ return TRUE;
+}
+#endif
+