Patch 8.0.1237
Problem: ":set scroll&" often gives an error.
Solution: Don't use a fixed default value, use half the window height. Add a
test. (Ozaki Kiichi, closes #2104)
Files: src/Makefile, src/option.c, src/testdir/test_alot.vim,
src/testdir/test_scroll_opt.vim
*** ../vim-8.0.1236/src/Makefile 2017-10-28 20:28:18.676167007 +0200
--- src/Makefile 2017-10-29 15:08:48.860272105 +0100
***************
*** 2242,2247 ****
--- 2242,2248 ----
test_reltime \
test_retab \
test_ruby \
+ test_scroll_opt \
test_scrollbind \
test_search \
test_searchpos \
*** ../vim-8.0.1236/src/option.c 2017-10-28 21:08:38.987456954 +0200
--- src/option.c 2017-10-29 15:25:00.185556476 +0100
***************
*** 2359,2365 ****
SCRIPTID_INIT},
{"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF,
(char_u *)VAR_WIN, PV_SCROLL,
! {(char_u *)12L, (char_u *)0L} SCRIPTID_INIT},
{"scrollbind", "scb", P_BOOL|P_VI_DEF,
#ifdef FEAT_SCROLLBIND
(char_u *)VAR_WIN, PV_SCBIND,
--- 2359,2365 ----
SCRIPTID_INIT},
{"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF,
(char_u *)VAR_WIN, PV_SCROLL,
! {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
{"scrollbind", "scb", P_BOOL|P_VI_DEF,
#ifdef FEAT_SCROLLBIND
(char_u *)VAR_WIN, PV_SCBIND,
***************
*** 3904,3913 ****
int idx;
/*
! * 'scroll' defaults to half the window height. Note that this default is
! * wrong when the window height changes.
*/
- set_number_default("scroll", (long)((long_u)Rows >> 1));
idx = findoption((char_u *)"scroll");
if (idx >= 0 && !(options[idx].flags & P_WAS_SET))
set_option_default(idx, OPT_LOCAL, p_cp);
--- 3904,3912 ----
int idx;
/*
! * 'scroll' defaults to half the window height. The stored default is
zero,
! * which results in the actual value computed from the window height.
*/
idx = findoption((char_u *)"scroll");
if (idx >= 0 && !(options[idx].flags & P_WAS_SET))
set_option_default(idx, OPT_LOCAL, p_cp);
*** ../vim-8.0.1236/src/testdir/test_alot.vim 2017-10-15 22:07:35.203683210
+0200
--- src/testdir/test_alot.vim 2017-10-29 15:08:48.868272050 +0100
***************
*** 41,46 ****
--- 41,47 ----
source test_put.vim
source test_recover.vim
source test_reltime.vim
+ source test_scroll_opt.vim
source test_searchpos.vim
source test_set.vim
source test_sort.vim
*** ../vim-8.0.1236/src/testdir/test_scroll_opt.vim 2017-10-29
15:26:20.612996852 +0100
--- src/testdir/test_scroll_opt.vim 2017-10-29 15:08:48.868272050 +0100
***************
*** 0 ****
--- 1,36 ----
+ " Test for reset 'scroll'
+ "
+
+ func Test_reset_scroll()
+ let scr = &l:scroll
+
+ setlocal scroll=1
+ setlocal scroll&
+ call assert_equal(scr, &l:scroll)
+
+ setlocal scroll=1
+ setlocal scroll=0
+ call assert_equal(scr, &l:scroll)
+
+ try
+ execute 'setlocal scroll=' . (winheight(0) + 1)
+ " not reached
+ call assert_false(1)
+ catch
+ call assert_exception('E49:')
+ endtry
+
+ split
+
+ let scr = &l:scroll
+
+ setlocal scroll=1
+ setlocal scroll&
+ call assert_equal(scr, &l:scroll)
+
+ setlocal scroll=1
+ setlocal scroll=0
+ call assert_equal(scr, &l:scroll)
+
+ quit!
+ endfunc
*** ../vim-8.0.1236/src/version.c 2017-10-28 21:08:38.995456898 +0200
--- src/version.c 2017-10-29 15:25:53.093188326 +0100
***************
*** 763,764 ****
--- 763,766 ----
{ /* Add new patch number below this line */
+ /**/
+ 1237,
/**/
--
An indication you must be a manager:
You believe you never have any problems in your life, just
"issues" and "improvement opportunities".
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
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].
For more options, visit https://groups.google.com/d/optout.