diff src/window.c @ 18467:99fc29219b3e v8.1.2227

patch 8.1.2227: layout wrong if 'lines' changes while cmdline window is open Commit: https://github.com/vim/vim/commit/1c329c04be2e95a3589a53f2978926e91b450cca Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 27 20:37:35 2019 +0100 patch 8.1.2227: layout wrong if 'lines' changes while cmdline window is open Problem: Layout wrong if 'lines' changes while cmdline window is open. Solution: Do not restore the window layout if 'lines' changed. (closes #5130)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Oct 2019 20:45:03 +0100
parents 9f51d0cef8da
children 41484f342f80
line wrap: on
line diff
--- a/src/window.c
+++ b/src/window.c
@@ -5177,17 +5177,23 @@ win_size_save(garray_T *gap)
     win_T	*wp;
 
     ga_init2(gap, (int)sizeof(int), 1);
-    if (ga_grow(gap, win_count() * 2) == OK)
+    if (ga_grow(gap, win_count() * 2 + 1) == OK)
+    {
+	// first entry is value of 'lines'
+	((int *)gap->ga_data)[gap->ga_len++] = Rows;
+
 	FOR_ALL_WINDOWS(wp)
 	{
 	    ((int *)gap->ga_data)[gap->ga_len++] =
 					       wp->w_width + wp->w_vsep_width;
 	    ((int *)gap->ga_data)[gap->ga_len++] = wp->w_height;
 	}
+    }
 }
 
 /*
- * Restore window sizes, but only if the number of windows is still the same.
+ * Restore window sizes, but only if the number of windows is still the same
+ * and 'lines' didn't change.
  * Does not free the growarray.
  */
     void
@@ -5196,13 +5202,14 @@ win_size_restore(garray_T *gap)
     win_T	*wp;
     int		i, j;
 
-    if (win_count() * 2 == gap->ga_len)
+    if (win_count() * 2 + 1 == gap->ga_len
+	    && ((int *)gap->ga_data)[0] == Rows)
     {
 	/* The order matters, because frames contain other frames, but it's
 	 * difficult to get right. The easy way out is to do it twice. */
 	for (j = 0; j < 2; ++j)
 	{
-	    i = 0;
+	    i = 1;
 	    FOR_ALL_WINDOWS(wp)
 	    {
 		frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]);
@@ -6374,7 +6381,7 @@ min_rows(void)
 }
 
 /*
- * Return TRUE if there is only one window (in the current tab page), not
+ * Return TRUE if there is only one window and only one tab page, not
  * counting a help or preview window, unless it is the current window.
  * Does not count unlisted windows.
  */