]> granicus.if.org Git - vim/commitdiff
patch 8.2.1936: session sets the local 'scrolloff' value to the global value v8.2.1936
authorBram Moolenaar <Bram@vim.org>
Sun, 1 Nov 2020 16:40:54 +0000 (17:40 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 1 Nov 2020 16:40:54 +0000 (17:40 +0100)
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
src/testdir/test_mksession.vim
src/version.c

index 829cca9e84ec4ca0378bb939e42e718efc3995af..44976e8cf45dc224a3d9289c9db6c8c8702fe508 100644 (file)
@@ -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
index 06be838296b2cdecb9a99fd57170dbf661d76ec3..7ae42f33674e09a50f818966da3b0fb63bec79ec 100644 (file)
@@ -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
index ed74a497fedb5bded99d07f3a2fe5aee0f3b3a5d..82bb09de7756a8775b81a86b7fbc4756bf50b65c 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1936,
 /**/
     1935,
 /**/