diff src/window.c @ 32319:23d44be6ec20 v9.0.1491

patch 9.0.1491: wrong scrolling with ls=0 and :botright split Commit: https://github.com/vim/vim/commit/fbf2071ac9ef08302a1df86c15f3d4ddbe871243 Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Apr 26 19:01:44 2023 +0100 patch 9.0.1491: wrong scrolling with ls=0 and :botright split Problem: Wrong scrolling with ls=0 and :botright split. Solution: Add statusline before calling frame_new_height(). (closes https://github.com/vim/vim/issues/12299)
author Bram Moolenaar <Bram@vim.org>
date Wed, 26 Apr 2023 20:15:04 +0200
parents bea4ebf594c6
children c114eebb5268
line wrap: on
line diff
--- a/src/window.c
+++ b/src/window.c
@@ -1307,6 +1307,7 @@ win_split_ins(
 	// "new_size" of the current window goes to the new window, use
 	// one row for the status line
 	win_new_height(wp, new_size);
+	int old_status_height = oldwin->w_status_height;
 	if (flags & (WSP_TOP | WSP_BOT))
 	{
 	    int new_fr_height = curfrp->fr_height - new_size
@@ -1314,6 +1315,8 @@ win_split_ins(
 
 	    if (!((flags & WSP_BOT) && p_ls == 0))
 		new_fr_height -= STATUS_HEIGHT;
+	    if (flags & WSP_BOT)
+		frame_add_statusline(curfrp);
 	    frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE);
 	}
 	else
@@ -1328,12 +1331,10 @@ win_split_ins(
 	{
 	    wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin)
 							       + STATUS_HEIGHT;
-	    wp->w_status_height = oldwin->w_status_height;
+	    wp->w_status_height = old_status_height;
 	    if (!(flags & WSP_BOT))
 		oldwin->w_status_height = STATUS_HEIGHT;
 	}
-	if (flags & WSP_BOT)
-	    frame_add_statusline(curfrp);
 	frame_fix_height(wp);
 	frame_fix_height(oldwin);
     }
@@ -3791,12 +3792,7 @@ frame_add_statusline(frame_T *frp)
     if (frp->fr_layout == FR_LEAF)
     {
 	wp = frp->fr_win;
-	if (wp->w_status_height == 0)
-	{
-	    if (wp->w_height > 0)	// don't make it negative
-		--wp->w_height;
-	    wp->w_status_height = STATUS_HEIGHT;
-	}
+	wp->w_status_height = STATUS_HEIGHT;
     }
     else if (frp->fr_layout == FR_ROW)
     {