summaryrefslogtreecommitdiff
path: root/src/testdir/test_scroll_opt.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-10-29 15:26:57 +0100
committerBram Moolenaar <Bram@vim.org>2017-10-29 15:26:57 +0100
commitaf2d20c6285c1d2973e3d9b5e8f727e3ed180493 (patch)
tree63d5f59ae2662b1799728fe8ac7e1144ad09f777 /src/testdir/test_scroll_opt.vim
parentd057301b1f28736f094affa17b190244ad56e8d9 (diff)
downloadvim-git-af2d20c6285c1d2973e3d9b5e8f727e3ed180493.tar.gz
patch 8.0.1237: ":set scroll&" often gives an errorv8.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)
Diffstat (limited to 'src/testdir/test_scroll_opt.vim')
-rw-r--r--src/testdir/test_scroll_opt.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
new file mode 100644
index 000000000..77920eb8b
--- /dev/null
+++ b/src/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