File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6321,7 +6321,9 @@ A jump table for the options with a short description can be found at |Q_op|.
63216321 local to window
63226322 Number of lines to scroll with CTRL-U and CTRL-D commands. Will be
63236323 set to half the number of lines in the window when the window size
6324- changes. If you give a count to the CTRL-U or CTRL-D command it will
6324+ changes. This may happen when enabling the | status-line | or
6325+ 'tabline' option after setting the 'scroll' option.
6326+ If you give a count to the CTRL-U or CTRL-D command it will
63256327 be used as the new value for 'scroll' . Reset to half the window
63266328 height with ":set scroll=0".
63276329
Original file line number Diff line number Diff line change @@ -1553,6 +1553,7 @@ scriptnames_slash_adjust(void)
15531553
15541554/*
15551555 * Get a pointer to a script name. Used for ":verbose set".
1556+ * Message appended to "Last set from "
15561557 */
15571558 char_u *
15581559get_scriptname (scid_T id )
@@ -1567,6 +1568,8 @@ get_scriptname(scid_T id)
15671568 return (char_u * )_ ("environment variable" );
15681569 if (id == SID_ERROR )
15691570 return (char_u * )_ ("error handler" );
1571+ if (id == SID_WINLAYOUT )
1572+ return (char_u * )_ ("changed window size" );
15701573 return SCRIPT_ITEM (id )-> sn_name ;
15711574}
15721575
Original file line number Diff line number Diff line change @@ -1013,4 +1013,22 @@ func Test_isfname_with_options()
10131013 setlocal keywordprg &
10141014endfunc
10151015
1016+ " Test that resetting laststatus does change scroll option
1017+ func Test_opt_reset_scroll ()
1018+ CheckRunVimInTerminal
1019+ let vimrc = << trim [CODE]
1020+ set scroll = 2
1021+ set laststatus = 2
1022+ [CODE]
1023+ call writefile (vimrc, ' Xscroll' )
1024+ let buf = RunVimInTerminal (' -S Xscroll' , {' rows' : 16 , ' cols' : 45 })
1025+ call term_sendkeys (buf , " :verbose set scroll?\n " )
1026+ call WaitForAssert ({- > assert_match (' Last set.*window size' , term_getline (buf , 15 ))})
1027+ call assert_match (' ^\s*scroll=7$' , term_getline (buf , 14 ))
1028+ call StopVimInTerminal (buf )
1029+
1030+ " clean up
1031+ call delete (' Xscroll' )
1032+ endfunc
1033+
10161034" vim: shiftwidth = 2 sts = 2 expandtab
Original file line number Diff line number Diff line change @@ -750,6 +750,8 @@ static char *(features[]) =
750750
751751static int included_patches [] =
752752{ /* Add new patch number below this line */
753+ /**/
754+ 2236 ,
753755/**/
754756 2235 ,
755757/**/
Original file line number Diff line number Diff line change @@ -1232,6 +1232,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring);
12321232#define SID_ENV -4 // for sourcing environment variable
12331233#define SID_ERROR -5 // option was reset because of an error
12341234#define SID_NONE -6 // don't set scriptID
1235+ #define SID_WINLAYOUT -7 // changing window size
12351236
12361237/*
12371238 * Events for autocommands.
Original file line number Diff line number Diff line change @@ -6325,9 +6325,21 @@ win_new_width(win_T *wp, int width)
63256325 void
63266326win_comp_scroll (win_T * wp )
63276327{
6328+ #if defined(FEAT_EVAL )
6329+ int old_w_p_scr = wp -> w_p_scr ;
6330+ #endif
6331+
63286332 wp -> w_p_scr = ((unsigned )wp -> w_height >> 1 );
63296333 if (wp -> w_p_scr == 0 )
63306334 wp -> w_p_scr = 1 ;
6335+ #if defined(FEAT_EVAL )
6336+ if (wp -> w_p_scr != old_w_p_scr )
6337+ {
6338+ // Used by "verbose set scroll".
6339+ wp -> w_p_script_ctx [WV_SCROLL ].sc_sid = SID_WINLAYOUT ;
6340+ wp -> w_p_script_ctx [WV_SCROLL ].sc_lnum = 0 ;
6341+ }
6342+ #endif
63316343}
63326344
63336345/*
You can’t perform that action at this time.
0 commit comments