summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_scroll_opt.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-01-26 14:14:43 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-26 14:14:43 +0000
commit870219c58c0804bdc55419b2e455c06ac715a835 (patch)
treef259e239be4a2a0e34d466c6446741d7f2d66844 /src/testdir/test_scroll_opt.vim
parent142ed77898facf8f423fee2717efee1749c55f9a (diff)
patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow windowv9.0.1247
Problem: Divide by zero with 'smoothscroll' set and a narrow window. Solution: Bail out when the window is too narrow.
Diffstat (limited to 'src/testdir/test_scroll_opt.vim')
-rw-r--r--src/testdir/test_scroll_opt.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index 2fa91682d8..58344f9a92 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -560,5 +560,32 @@ func Test_smoothscroll_mouse_pos()
let &ttymouse = save_ttymouse
endfunc
+" this was dividing by zero
+func Test_smoothscrol_zero_width()
+ CheckScreendump
+
+ let lines =<< trim END
+ winsize 0 0
+ vsplit
+ vsplit
+ vsplit
+ vsplit
+ vsplit
+ sil norm H
+ set wrap
+ set smoothscroll
+ set number
+ END
+ call writefile(lines, 'XSmoothScrollZero', 'D')
+ let buf = RunVimInTerminal('-u NONE -i NONE -n -m -X -Z -e -s -S XSmoothScrollZero', #{rows: 6, cols: 60, wait_for_ruler: 0})
+ call TermWait(buf, 3000)
+ call VerifyScreenDump(buf, 'Test_smoothscroll_zero_1', {})
+
+ call term_sendkeys(buf, ":sil norm \<C-V>\<C-W>\<C-V>\<C-N>\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_zero_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab