Skip to content

Commit

Permalink
patch 8.2.1936: session sets the local 'scrolloff' value to the globa…
Browse files Browse the repository at this point in the history
…l 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.
  • Loading branch information
brammool committed Nov 1, 2020
1 parent 578f4cc commit 3889083
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ ex_mkrc(exarg_T *eap)
#ifdef FEAT_SESSION
if (!failed && view_session)
{
if (put_line(fd, "let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0") == FAIL)
if (put_line(fd, "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)
{
Expand Down Expand Up @@ -1261,7 +1261,7 @@ ex_mkrc(exarg_T *eap)
failed |= (put_view(fd, curwin, !using_vdir, flagp, -1, NULL)
== FAIL);
}
if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save")
if (put_line(fd, "let &g:so = s:so_save | let &g:siso = s:siso_save")
== FAIL)
failed = TRUE;
#ifdef FEAT_SEARCH_EXTRA
Expand Down
13 changes: 13 additions & 0 deletions src/testdir/test_mksession.vim
Original file line number Diff line number Diff line change
Expand Up @@ -859,4 +859,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
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1936,
/**/
1935,
/**/
Expand Down

0 comments on commit 3889083

Please sign in to comment.