diff options
| -rw-r--r-- | src/nvim/option.c | 7 | ||||
| -rw-r--r-- | src/nvim/options.lua | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test_alot.vim | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test_scroll_opt.vim | 36 | 
4 files changed, 40 insertions, 6 deletions
| diff --git a/src/nvim/option.c b/src/nvim/option.c index 88c458b597..26fc164c6c 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -939,11 +939,8 @@ void set_init_2(bool headless)  {    int idx; -  /* -   * 'scroll' defaults to half the window height. Note that this default is -   * wrong when the window height changes. -   */ -  set_number_default("scroll", Rows / 2); +  // '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("scroll");    if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) {      set_option_default(idx, OPT_LOCAL, p_cp); diff --git a/src/nvim/options.lua b/src/nvim/options.lua index f1f559fff0..47c9f5aa78 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1922,7 +1922,7 @@ return {        no_mkrc=true,        vi_def=true,        pv_name='p_scroll', -      defaults={if_true={vi=12}} +      defaults={if_true={vi=0}}      },      {        full_name='scrollback', abbreviation='scbk', diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index b4baf7a8d7..c4b4a43ad4 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -27,6 +27,7 @@ source test_popup.vim  source test_put.vim  source test_recover.vim  source test_regexp_utf8.vim +source test_scroll_opt.vim  source test_source_utf8.vim  source test_sha256.vim  source test_statusline.vim diff --git a/src/nvim/testdir/test_scroll_opt.vim b/src/nvim/testdir/test_scroll_opt.vim new file mode 100644 index 0000000000..77920eb8b0 --- /dev/null +++ b/src/nvim/testdir/test_scroll_opt.vim @@ -0,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 | 
