Patch 8.2.1936
Problem: Session sets the local 'scrolloff' value to the global value.
Solution: Do not let restoring the global option value change the local
value.
Files: src/session.c, src/testdir/test_mksession.vim
*** ../vim-8.2.1935/src/session.c 2020-10-24 20:49:37.502683026 +0200
--- src/session.c 2020-11-01 17:36:47.902365512 +0100
***************
*** 1216,1222 ****
#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)
failed = TRUE;
if (eap->cmdidx == CMD_mksession)
{
--- 1216,1222 ----
#ifdef FEAT_SESSION
if (!failed && view_session)
{
! 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,1267 ****
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")
== FAIL)
failed = TRUE;
#ifdef FEAT_SEARCH_EXTRA
--- 1261,1267 ----
failed |= (put_view(fd, curwin, !using_vdir, flagp, -1, NULL)
== FAIL);
}
! if (put_line(fd, "let &g:so = s:so_save | let &g:siso = s:siso_save")
== FAIL)
failed = TRUE;
#ifdef FEAT_SEARCH_EXTRA
*** ../vim-8.2.1935/src/testdir/test_mksession.vim 2020-09-11 22:10:17.965597366 +0200
--- src/testdir/test_mksession.vim 2020-11-01 17:36:47.902365512 +0100
***************
*** 859,862 ****
--- 859,875 ----
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
*** ../vim-8.2.1935/src/version.c 2020-11-01 17:19:01.677362237 +0100
--- src/version.c 2020-11-01 17:39:14.809911288 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1936,
/**/
--
If Microsoft would build a car...
... the oil, water temperature, and alternator warning lights would
all be replaced by a single "General Protection Fault" warning light.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///