]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0413: Scrolling wrong with 'splitkeep' when changing 'cmdheight' v9.2.0413
authorLuuk van Baal <luukvbaal@gmail.com>
Tue, 28 Apr 2026 21:09:45 +0000 (21:09 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 28 Apr 2026 21:14:50 +0000 (21:14 +0000)
Problem:  Cursor is not adjusted when 'cmdheight' is changed to cover
          the cursor with 'splitkeep' ~= "cursor".
Solution: Handle window resize for 'splitkeep' after changing 'cmdheight'.
          Ensure previous window height is set when changing 'splitkeep'
          (Luuk van Baal).

closes: #20043

Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/optionstr.c
src/testdir/test_window_cmd.vim
src/version.c
src/window.c

index 72f5dd3ced848ed7e09453ebd9bd9e2898bf7695..0390d2dac77e14a70d79325d6191a3495eb787bd 100644 (file)
@@ -4384,6 +4384,10 @@ expand_set_spellsuggest(optexpand_T *args, int *numMatches, char_u ***matches)
     char *
 did_set_splitkeep(optset_T *args UNUSED)
 {
+    win_T      *wp;
+    tabpage_T  *tp;
+    FOR_ALL_TAB_WINDOWS(tp, wp)
+       wp->w_prev_height = wp->w_height;
     return did_set_opt_strings(p_spk, p_spk_values, FALSE);
 }
 
index 98e9ba83dba5db80d7218d78cd885b6f8b2d3ef6..b1305c77e146a2ea23ed2be2c611b68b3bb016aa 100644 (file)
@@ -1992,6 +1992,16 @@ func Test_splitkeep_screen_cursor_pos()
   set splitkeep&
 endfunc
 
+func Test_splitkeep_cmdheight()
+  set splitkeep=screen
+  call setline(1, range(&lines))
+  norm! G
+  set cmdheight=2
+  call assert_equal(&lines - 1, line('.'))
+  %bwipeout!
+  set splitkeep& cmdheight&
+endfunc
+
 func Test_splitkeep_cursor()
   CheckScreendump
   let lines =<< trim END
index 778a227b7a2b4752ecbce9f49a24818f519bc5fd..824a80de9c9253f46b22e8cf9624dd89e2586a1b 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    413,
 /**/
     412,
 /**/
index c3acd7af3359983f0ee39fc5175c9b7721bc4273..8813ffa808ee7ed1f145202aa58dba094409cef5 100644 (file)
@@ -7591,6 +7591,7 @@ command_height(void)
     }
     if (p_ch < old_p_ch && command_frame_height && frp != NULL)
        frame_add_height(frp, (int)(old_p_ch - p_ch));
+    win_fix_scroll(true);
 
     // Recompute window positions.
     win_comp_pos();