From 388908352f88e7391accb3545b082db0fc89d9f7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 1 Nov 2020 17:40:54 +0100 Subject: 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. --- src/session.c | 4 ++-- src/testdir/test_mksession.vim | 13 +++++++++++++ src/version.c | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/session.c b/src/session.c index 829cca9e8..44976e8cf 100644 --- a/src/session.c +++ b/src/session.c @@ -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) { @@ -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 diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim index 06be83829..7ae42f336 100644 --- a/src/testdir/test_mksession.vim +++ b/src/testdir/test_mksession.vim @@ -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 diff --git a/src/version.c b/src/version.c index ed74a497f..82bb09de7 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1936, /**/ 1935, /**/ -- cgit v1.2.1