changeset 26486:8d598308f113 v8.2.3773

patch 8.2.3773: wrong window size when a modeline changes 'columns' Commit: https://github.com/vim/vim/commit/8a7374f8c4eb4c016270ad908a43af4ddedcbf56 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 10 12:11:09 2021 +0000 patch 8.2.3773: wrong window size when a modeline changes 'columns' Problem: Wrong window size when a modeline changes 'columns' and there is more than one tabpage. (Michael Soyka) Solution: Adjust the frames of all tabpages. (closes #9315)
author Bram Moolenaar <Bram@vim.org>
date Fri, 10 Dec 2021 13:15:02 +0100
parents 9091abdf5363
children 24b0a8540cf4
files src/version.c src/window.c
diffstat 2 files changed, 27 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3773,
+/**/
     3772,
 /**/
     3771,
--- a/src/window.c
+++ b/src/window.c
@@ -5353,18 +5353,24 @@ win_free_lsize(win_T *wp)
     void
 shell_new_rows(void)
 {
-    int		h = (int)ROWS_AVAIL;
+    tabpage_T	*tp;
 
     if (firstwin == NULL)	// not initialized yet
 	return;
-    if (h < frame_minheight(topframe, NULL))
-	h = frame_minheight(topframe, NULL);
-
-    // 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 (!frame_check_height(topframe, h))
-	frame_new_height(topframe, h, FALSE, FALSE);
+
+    FOR_ALL_TABPAGES(tp)
+    {
+	int		h = (int)ROWS_AVAIL;
+
+	if (h < frame_minheight(tp->tp_topframe, NULL))
+	    h = frame_minheight(tp->tp_topframe, NULL);
+
+	// 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(tp->tp_topframe, h, FALSE, TRUE);
+	if (!frame_check_height(tp->tp_topframe, h))
+	    frame_new_height(tp->tp_topframe, h, FALSE, FALSE);
+    }
 
     (void)win_comp_pos();		// recompute w_winrow and w_wincol
     compute_cmdrow();
@@ -5383,14 +5389,19 @@ shell_new_rows(void)
     void
 shell_new_columns(void)
 {
+    tabpage_T	*tp;
+
     if (firstwin == NULL)	// not initialized yet
 	return;
 
-    // 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 (!frame_check_width(topframe, Columns))
-	frame_new_width(topframe, (int)Columns, FALSE, FALSE);
+    FOR_ALL_TABPAGES(tp)
+    {
+	// 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(tp->tp_topframe, (int)Columns, FALSE, TRUE);
+	if (!frame_check_width(tp->tp_topframe, Columns))
+	    frame_new_width(tp->tp_topframe, (int)Columns, FALSE, FALSE);
+    }
 
     (void)win_comp_pos();		// recompute w_winrow and w_wincol
 #if 0