summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_scroll_opt.vim
diff options
context:
space:
mode:
authorfullwaywang <fullwaywang@tencent.com>2023-06-24 21:58:09 +0100
committerBram Moolenaar <Bram@vim.org>2023-06-24 21:58:09 +0100
commit8154e642aa476e1a5d3de66c34e8289845b2b797 (patch)
tree77568c08d310052f35548abf879939a5a4756b62 /src/testdir/test_scroll_opt.vim
parentc9a4a8ab28da2b11856a3f08ccba2e91f46b85c3 (diff)
patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' setv9.0.1664
Problem: Divide by zero when scrolling with 'smoothscroll' set. Solution: Avoid using a negative width. (closes #12540, closes #12528)
Diffstat (limited to 'src/testdir/test_scroll_opt.vim')
-rw-r--r--src/testdir/test_scroll_opt.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index 460416665d..279e547f86 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -833,4 +833,28 @@ func Test_smoothscroll_multi_skipcol()
call StopVimInTerminal(buf)
endfunc
+" this was dividing by zero bug in scroll_cursor_bot
+func Test_smoothscroll_zero_width_scroll_cursor_bot()
+ CheckScreendump
+
+ let lines =<< trim END
+ silent normal yy
+ silent normal 19p
+ winsize 0 19
+ vsplit
+ vertical resize 0
+ set foldcolumn=1
+ set number
+ set smoothscroll
+ silent normal 20G
+ END
+ call writefile(lines, 'XSmoothScrollZeroBot', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothScrollZeroBot', #{rows: 19, wait_for_ruler: 0})
+ call TermWait(buf, 1000)
+
+ call VerifyScreenDump(buf, 'Test_smoothscroll_zero_bot', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab