Commit: patch 9.2.0871: screen line is lost when splitting a 'winfixheight' window

Christian Brabandt <[email protected]> Wed, 29 Jul 2026 20:45:04 +0200
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
patch 9.2.0871: screen line is lost when splitting a 'winfixheight' window

Commit: https://github.com/vim/vim/commit/ab36bcc870f47a96c00602bd50bdf1aeb09e71da
Author: Hirohito Higashi <[email protected]>
Date:   Tue Jul 28 20:45:27 2026 +0000

    patch 9.2.0871: screen line is lost when splitting a 'winfixheight' window
    
    Problem:  When the only window has 'winfixheight' set and 'laststatus'
              is one, splitting it leaves one screen line unused.  This
              happens for example when jumping to an item from a maximized
              quickfix window (rendcrx)
    Solution: Do not subtract the height of the status line twice
              (Hirohito Higashi)
    
    fixes:  #20495
    closes: #20871
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    Signed-off-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index e7f391ed9..bf524030f 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -2481,6 +2481,23 @@ func Test_winfixheight_resize_wmh_zero()
   set winminheight& laststatus&
 endfunc
 
+" Splitting the only window while it has 'winfixheight' set and 'laststatus' is
+" one must not leave a screen line unused.
+func Test_winfixheight_split_only_window()
+  set laststatus=1
+  new
+  only!
+  setlocal winfixheight
+  split
+  " Two windows, both with a status line, and the command line.
+  call assert_equal(&lines - &cmdheight - 2, winheight(1) + winheight(2))
+
+  only!
+  setlocal winfixheight&
+  set laststatus&
+  bwipe!
+endfunc
+
 " Test that setting 'laststatus' from 0 to 2 gives all windows in a vertical
 " split (FR_ROW) the same height and correct status line position.
 func Test_laststatus_vsplit_row_height()
diff --git a/src/version.c b/src/version.c
index 167dd4938..725d66af7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    871,
 /**/
     870,
 /**/
diff --git a/src/window.c b/src/window.c
index 3933f4e88..f2ee69071 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1232,9 +1232,8 @@ win_split_ins(
 
 	    win_setheight_win(oldwin->w_height + new_size
 		    + statusline_height(oldwin), oldwin);
+	    // w_height now excludes the status line
 	    oldwin_height = oldwin->w_height;
-	    if (need_status)
-		oldwin_height -= statusline_height(oldwin);
 	}
 
 	// Only make all windows the same height if one of them (except oldwin)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wp9H6-002sWW-Ov%40256bit.org.