Patch 9.0.1670
Problem: Resetting local option to global value is inconsistent.
Solution: Handle "<" specifically for 'scrolloff' and 'sidescrolloff'.
(closes #12594)
Files: src/option.c, src/testdir/test_options.vim
*** ../vim-9.0.1669/src/option.c 2023-06-14 16:39:48.653873856 +0100
--- src/option.c 2023-06-27 21:38:26.458836083 +0100
***************
*** 2135,2144 ****
((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT];
else if (nextchar == '<')
{
- // For 'undolevels' NO_LOCAL_UNDOLEVEL means to
- // use the global value.
if ((long *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL)
value = NO_LOCAL_UNDOLEVEL;
else
value = *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
}
--- 2135,2148 ----
((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT];
else if (nextchar == '<')
{
if ((long *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL)
+ // for 'undolevels' NO_LOCAL_UNDOLEVEL means using the global value
value = NO_LOCAL_UNDOLEVEL;
+ else if (opt_flags == OPT_LOCAL
+ && ((long *)varp == &curwin->w_p_siso
+ || (long *)varp == &curwin->w_p_so))
+ // for 'scrolloff'/'sidescrolloff' -1 means using the global value
+ value = -1;
else
value = *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
}
*** ../vim-9.0.1669/src/testdir/test_options.vim 2023-06-14
16:39:48.657873849 +0100
--- src/testdir/test_options.vim 2023-06-27 21:49:52.126562164 +0100
***************
*** 954,965 ****
wincmd w
call assert_equal(5, &so)
wincmd w
setlocal so<
call assert_equal(5, &so)
setlocal so=0
call assert_equal(0, &so)
setlocal so=-1
! call assert_equal(5, &so)
call assert_equal(7, &siso)
setlocal siso=3
--- 954,969 ----
wincmd w
call assert_equal(5, &so)
wincmd w
+ call assert_equal(3, &so)
setlocal so<
call assert_equal(5, &so)
+ setglob so=8
+ call assert_equal(8, &so)
+ call assert_equal(-1, &l:so)
setlocal so=0
call assert_equal(0, &so)
setlocal so=-1
! call assert_equal(8, &so)
call assert_equal(7, &siso)
setlocal siso=3
***************
*** 967,978 ****
wincmd w
call assert_equal(7, &siso)
wincmd w
setlocal siso<
call assert_equal(7, &siso)
setlocal siso=0
call assert_equal(0, &siso)
setlocal siso=-1
! call assert_equal(7, &siso)
close
set so&
--- 971,986 ----
wincmd w
call assert_equal(7, &siso)
wincmd w
+ call assert_equal(3, &siso)
setlocal siso<
call assert_equal(7, &siso)
+ setglob siso=4
+ call assert_equal(4, &siso)
+ call assert_equal(-1, &l:siso)
setlocal siso=0
call assert_equal(0, &siso)
setlocal siso=-1
! call assert_equal(4, &siso)
close
set so&
*** ../vim-9.0.1669/src/version.c 2023-06-27 18:57:06.448499587 +0100
--- src/version.c 2023-06-27 21:38:10.094852929 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1670,
/**/
--
hundred-and-one symptoms of being an internet addict:
243. You unsuccessfully try to download a pizza from www.dominos.com.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230627205136.0C5EC1C054C%40moolenaar.net.