changeset 30134:0211a930d873 v9.0.0403

patch 9.0.0403: 'equalalways' may be off when 'laststatus' is zero Commit: https://github.com/vim/vim/commit/fd7e60a33ddd83a82da4eb6267f1c12fa926f32b Author: Luuk van Baal <luukvbaal@gmail.com> Date: Wed Sep 7 14:42:49 2022 +0100 patch 9.0.0403: 'equalalways' may be off when 'laststatus' is zero Problem: 'equalalways' may be off when 'laststatus' is zero. Solution: call last_status() before win_equal(). (Luuk van Baal, closes #11070)
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Sep 2022 15:45:05 +0200
parents a118dcb936b1
children e791a968eae1
files src/testdir/test_window_cmd.vim src/version.c src/window.c
diffstat 3 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1617,4 +1617,19 @@ func Test_window_alloc_failure()
   tabonly
 endfunc
 
+func Test_win_equal_last_status()
+  let save_lines = &lines
+  set lines=20
+  set splitbelow
+  set laststatus=0
+
+  split | split | quit
+  call assert_equal(winheight(1), winheight(2))
+
+  let &lines = save_lines
+  set splitbelow&
+  set laststatus&
+endfunc
+
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    403,
+/**/
     402,
 /**/
     401,
--- a/src/window.c
+++ b/src/window.c
@@ -2712,6 +2712,14 @@ win_close(win_T *win, int free_buf)
 	// using the window.
 	check_cursor();
     }
+
+    /*
+     * If last window has a status line now and we don't want one, remove the
+     * status line.  Do this before win_equal(), because it may change the
+     * height of a window
+     */
+    last_status(FALSE);
+
     if (p_ea && (*p_ead == 'b' || *p_ead == dir))
 	// If the frame of the closed window contains the new current window,
 	// only resize that frame.  Otherwise resize all windows.
@@ -2741,12 +2749,6 @@ win_close(win_T *win, int free_buf)
 	--dont_parse_messages;
 #endif
 
-    /*
-     * If last window has a status line now and we don't want one,
-     * remove the status line.
-     */
-    last_status(FALSE);
-
     // After closing the help window, try restoring the window layout from
     // before it was opened.
     if (help_window)