vim-patch:8.2.1936: session sets the local 'scrolloff' value to the global value

Problem:    Session sets the local 'scrolloff' value to the global value.
Solution:   Do not let restoring the global option value change the local
            value.
388908352f
This commit is contained in:
Jan Edmund Lazo 2020-11-01 12:17:45 -05:00
parent ff11247837
commit 4b398413e4
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 16 additions and 3 deletions

View File

@ -897,8 +897,8 @@ void ex_mkrc(exarg_T *eap)
if (!failed && view_session) {
if (put_line(fd,
"let s:so_save = &so | let s:siso_save = &siso"
" | set so=0 siso=0") == FAIL) {
"let s:so_save = &g:so | let s:siso_save = &g:siso"
" | setg so=0 siso=0 | setl so=-1 siso=-1") == FAIL) {
failed = true;
}
if (eap->cmdidx == CMD_mksession) {
@ -949,7 +949,7 @@ void ex_mkrc(exarg_T *eap)
}
if (fprintf(fd,
"%s",
"let &so = s:so_save | let &siso = s:siso_save\n"
"let &g:so = s:so_save | let &g:siso = s:siso_save\n"
"doautoall SessionLoadPost\n")
< 0) {
failed = true;

View File

@ -470,4 +470,17 @@ func Test_mkvimrc()
call delete('Xtestvimrc')
endfunc
func Test_scrolloff()
set sessionoptions+=localoptions
setlocal so=1 siso=1
mksession! Xtest_mks.out
setlocal so=-1 siso=-1
source Xtest_mks.out
call assert_equal(1, &l:so)
call assert_equal(1, &l:siso)
call delete('Xtest_mks.out')
setlocal so& siso&
set sessionoptions&
endfunc
" vim: shiftwidth=2 sts=2 expandtab