summaryrefslogtreecommitdiffstats
path: root/src/testdir
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
parentd057301b1f28736f094affa17b190244ad56e8d9 (diff)
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')
-rw-r--r--src/testdir/test_alot.vim1
-rw-r--r--src/testdir/test_scroll_opt.vim36
2 files changed, 37 insertions, 0 deletions
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index ad133033ac..b8a56502b1 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -41,6 +41,7 @@ source test_popup.vim
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
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
new file mode 100644
index 0000000000..77920eb8b0
--- /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