annotate src/testdir/test_scroll_opt.vim @ 32665:23e24f3cae03 v9.0.1664

patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set Commit: https://github.com/vim/vim/commit/8154e642aa476e1a5d3de66c34e8289845b2b797 Author: fullwaywang <fullwaywang@tencent.com> Date: Sat Jun 24 21:58:09 2023 +0100 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set Problem: Divide by zero when scrolling with 'smoothscroll' set. Solution: Avoid using a negative width. (closes https://github.com/vim/vim/issues/12540, closes https://github.com/vim/vim/issues/12528)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jun 2023 23:00:04 +0200
parents f8eca24e58d6
children 448aef880252
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30610
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1 " Test for reset 'scroll' and 'smoothscroll'
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
2
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
3 source check.vim
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
4 source screendump.vim
31154
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
5 source mouse.vim
12718
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_reset_scroll()
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let scr = &l:scroll
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 setlocal scroll=1
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 setlocal scroll&
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call assert_equal(scr, &l:scroll)
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 setlocal scroll=1
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 setlocal scroll=0
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal(scr, &l:scroll)
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 try
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 execute 'setlocal scroll=' . (winheight(0) + 1)
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " not reached
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_false(1)
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 catch
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_exception('E49:')
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 endtry
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 split
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let scr = &l:scroll
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 setlocal scroll=1
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 setlocal scroll&
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal(scr, &l:scroll)
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 setlocal scroll=1
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 setlocal scroll=0
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal(scr, &l:scroll)
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 quit!
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 12718
diff changeset
40
31954
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
41 func Test_scolloff_even_line_count()
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
42 new
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
43 resize 6
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
44 setlocal scrolloff=3
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
45 call setline(1, range(20))
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
46 normal 2j
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
47 call assert_equal(1, getwininfo(win_getid())[0].topline)
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
48 normal j
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
49 call assert_equal(1, getwininfo(win_getid())[0].topline)
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
50 normal j
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
51 call assert_equal(2, getwininfo(win_getid())[0].topline)
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
52 normal j
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
53 call assert_equal(3, getwininfo(win_getid())[0].topline)
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
54
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
55 bwipe!
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
56 endfunc
d8fdafc4b390 patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
57
30620
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
58 func Test_CtrlE_CtrlY_stop_at_end()
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
59 enew
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
60 call setline(1, ['one', 'two'])
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
61 set number
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
62 exe "normal \<C-Y>"
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
63 call assert_equal([" 1 one "], ScreenLines(1, 10))
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
64 exe "normal \<C-E>\<C-E>\<C-E>"
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
65 call assert_equal([" 2 two "], ScreenLines(1, 10))
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
66
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
67 bwipe!
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
68 set nonumber
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
69 endfunc
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
70
30610
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
71 func Test_smoothscroll_CtrlE_CtrlY()
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
72 CheckScreendump
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
73
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
74 let lines =<< trim END
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
75 vim9script
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
76 setline(1, [
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
77 'line one',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
78 'word '->repeat(20),
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
79 'line three',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
80 'long word '->repeat(7),
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
81 'line',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
82 'line',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
83 'line',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
84 ])
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
85 set smoothscroll
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
86 :5
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
87 END
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
88 call writefile(lines, 'XSmoothScroll', 'D')
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
89 let buf = RunVimInTerminal('-S XSmoothScroll', #{rows: 12, cols: 40})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
90
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
91 call term_sendkeys(buf, "\<C-E>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
92 call VerifyScreenDump(buf, 'Test_smoothscroll_1', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
93 call term_sendkeys(buf, "\<C-E>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
94 call VerifyScreenDump(buf, 'Test_smoothscroll_2', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
95 call term_sendkeys(buf, "\<C-E>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
96 call VerifyScreenDump(buf, 'Test_smoothscroll_3', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
97 call term_sendkeys(buf, "\<C-E>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
98 call VerifyScreenDump(buf, 'Test_smoothscroll_4', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
99
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
100 call term_sendkeys(buf, "\<C-Y>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
101 call VerifyScreenDump(buf, 'Test_smoothscroll_5', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
102 call term_sendkeys(buf, "\<C-Y>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
103 call VerifyScreenDump(buf, 'Test_smoothscroll_6', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
104 call term_sendkeys(buf, "\<C-Y>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
105 call VerifyScreenDump(buf, 'Test_smoothscroll_7', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
106 call term_sendkeys(buf, "\<C-Y>")
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
107 call VerifyScreenDump(buf, 'Test_smoothscroll_8', {})
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
108
30622
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
109 if has('folding')
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
110 call term_sendkeys(buf, ":set foldmethod=indent\<CR>")
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
111 " move the cursor so we can reuse the same dumps
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
112 call term_sendkeys(buf, "5G")
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
113 call term_sendkeys(buf, "\<C-E>")
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
114 call VerifyScreenDump(buf, 'Test_smoothscroll_1', {})
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
115 call term_sendkeys(buf, "\<C-E>")
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
116 call VerifyScreenDump(buf, 'Test_smoothscroll_2', {})
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
117 call term_sendkeys(buf, "7G")
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
118 call term_sendkeys(buf, "\<C-Y>")
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
119 call VerifyScreenDump(buf, 'Test_smoothscroll_7', {})
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
120 call term_sendkeys(buf, "\<C-Y>")
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
121 call VerifyScreenDump(buf, 'Test_smoothscroll_8', {})
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
122 endif
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
123
30610
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
124 call StopVimInTerminal(buf)
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
125 endfunc
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
126
32561
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
127 func Test_smoothscroll_multibyte()
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
128 CheckScreendump
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
129
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
130 let lines =<< trim END
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
131 set scrolloff=0 smoothscroll
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
132 call setline(1, [repeat('ϛ', 45), repeat('2', 36)])
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
133 exe "normal G35l\<C-E>k"
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
134 END
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
135 call writefile(lines, 'XSmoothMultibyte', 'D')
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
136 let buf = RunVimInTerminal('-S XSmoothMultibyte', #{rows: 6, cols: 40})
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
137 call VerifyScreenDump(buf, 'Test_smoothscroll_multi_1', {})
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
138
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
139 call StopVimInTerminal(buf)
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
140 endfunc
f8eca24e58d6 patch 9.0.1612: "skipcol" not reset when using multi-byte characters
Bram Moolenaar <Bram@vim.org>
parents: 32557
diff changeset
141
30635
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
142 func Test_smoothscroll_number()
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
143 CheckScreendump
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
144
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
145 let lines =<< trim END
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
146 vim9script
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
147 setline(1, [
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
148 'one ' .. 'word '->repeat(20),
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
149 'two ' .. 'long word '->repeat(7),
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
150 'line',
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
151 'line',
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
152 'line',
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
153 ])
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
154 set smoothscroll
32349
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
155 set splitkeep=topline
30635
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
156 set number cpo+=n
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
157 :3
30845
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
158
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
159 def g:DoRel()
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
160 set number relativenumber scrolloff=0
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
161 :%del
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
162 setline(1, [
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
163 'one',
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
164 'very long text '->repeat(12),
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
165 'three',
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
166 ])
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
167 exe "normal 2Gzt\<C-E>"
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
168 enddef
30635
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
169 END
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
170 call writefile(lines, 'XSmoothNumber', 'D')
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
171 let buf = RunVimInTerminal('-S XSmoothNumber', #{rows: 12, cols: 40})
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
172
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
173 call VerifyScreenDump(buf, 'Test_smooth_number_1', {})
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
174 call term_sendkeys(buf, "\<C-E>")
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
175 call VerifyScreenDump(buf, 'Test_smooth_number_2', {})
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
176 call term_sendkeys(buf, "\<C-E>")
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
177 call VerifyScreenDump(buf, 'Test_smooth_number_3', {})
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
178
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
179 call term_sendkeys(buf, ":set cpo-=n\<CR>")
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
180 call VerifyScreenDump(buf, 'Test_smooth_number_4', {})
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
181 call term_sendkeys(buf, "\<C-Y>")
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
182 call VerifyScreenDump(buf, 'Test_smooth_number_5', {})
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
183 call term_sendkeys(buf, "\<C-Y>")
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
184 call VerifyScreenDump(buf, 'Test_smooth_number_6', {})
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
185
32349
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
186 call term_sendkeys(buf, ":botright split\<CR>gg")
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
187 call VerifyScreenDump(buf, 'Test_smooth_number_7', {})
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
188 call term_sendkeys(buf, "\<C-E>")
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
189 call VerifyScreenDump(buf, 'Test_smooth_number_8', {})
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
190 call term_sendkeys(buf, "\<C-E>")
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
191 call VerifyScreenDump(buf, 'Test_smooth_number_9', {})
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
192 call term_sendkeys(buf, ":close\<CR>")
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
193
30845
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
194 call term_sendkeys(buf, ":call DoRel()\<CR>")
32349
8323e235ff44 patch 9.0.1506: line number not displayed when using 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31954
diff changeset
195 call VerifyScreenDump(buf, 'Test_smooth_number_10', {})
30845
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
196
30635
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
197 call StopVimInTerminal(buf)
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
198 endfunc
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
199
30847
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
200 func Test_smoothscroll_list()
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
201 CheckScreendump
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
202
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
203 let lines =<< trim END
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
204 vim9script
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
205 set smoothscroll scrolloff=0
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
206 set list
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
207 setline(1, [
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
208 'one',
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
209 'very long text '->repeat(12),
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
210 'three',
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
211 ])
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
212 exe "normal 2Gzt\<C-E>"
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
213 END
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
214 call writefile(lines, 'XSmoothList', 'D')
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
215 let buf = RunVimInTerminal('-S XSmoothList', #{rows: 8, cols: 40})
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
216
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
217 call VerifyScreenDump(buf, 'Test_smooth_list_1', {})
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
218
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
219 call term_sendkeys(buf, ":set listchars+=precedes:#\<CR>")
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
220 call VerifyScreenDump(buf, 'Test_smooth_list_2', {})
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
221
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
222 call StopVimInTerminal(buf)
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
223 endfunc
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
224
30673
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
225 func Test_smoothscroll_diff_mode()
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
226 CheckScreendump
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
227
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
228 let lines =<< trim END
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
229 vim9script
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
230 var text = 'just some text here'
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
231 setline(1, text)
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
232 set smoothscroll
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
233 diffthis
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
234 new
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
235 setline(1, text)
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
236 set smoothscroll
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
237 diffthis
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
238 END
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
239 call writefile(lines, 'XSmoothDiff', 'D')
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
240 let buf = RunVimInTerminal('-S XSmoothDiff', #{rows: 8})
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
241
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
242 call VerifyScreenDump(buf, 'Test_smooth_diff_1', {})
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
243 call term_sendkeys(buf, "\<C-Y>")
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
244 call VerifyScreenDump(buf, 'Test_smooth_diff_1', {})
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
245 call term_sendkeys(buf, "\<C-E>")
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
246 call VerifyScreenDump(buf, 'Test_smooth_diff_1', {})
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
247
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
248 call StopVimInTerminal(buf)
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
249 endfunc
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
250
30675
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
251 func Test_smoothscroll_wrap_scrolloff_zero()
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
252 CheckScreendump
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
253
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
254 let lines =<< trim END
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
255 vim9script
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
256 setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
257 set smoothscroll scrolloff=0
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
258 :3
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
259 END
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
260 call writefile(lines, 'XSmoothWrap', 'D')
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
261 let buf = RunVimInTerminal('-S XSmoothWrap', #{rows: 8, cols: 40})
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
262
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
263 call VerifyScreenDump(buf, 'Test_smooth_wrap_1', {})
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
264
30677
a345ad853b08 patch 9.0.0673: first line wong with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30675
diff changeset
265 " moving cursor down - whole bottom line shows
30675
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
266 call term_sendkeys(buf, "j")
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
267 call VerifyScreenDump(buf, 'Test_smooth_wrap_2', {})
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
268
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
269 call term_sendkeys(buf, "\<C-E>j")
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
270 call VerifyScreenDump(buf, 'Test_smooth_wrap_3', {})
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
271
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
272 call term_sendkeys(buf, "G")
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
273 call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {})
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
274
32473
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
275 call term_sendkeys(buf, "4\<C-Y>G")
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
276 call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {})
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
277
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
278 " moving cursor up right after the <<< marker - no need to show whole line
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
279 call term_sendkeys(buf, "2gj3l2k")
30677
a345ad853b08 patch 9.0.0673: first line wong with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30675
diff changeset
280 call VerifyScreenDump(buf, 'Test_smooth_wrap_5', {})
a345ad853b08 patch 9.0.0673: first line wong with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30675
diff changeset
281
32473
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
282 " moving cursor up where the <<< marker is - whole top line shows
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
283 call term_sendkeys(buf, "2j02k")
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
284 call VerifyScreenDump(buf, 'Test_smooth_wrap_6', {})
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
285
30675
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
286 call StopVimInTerminal(buf)
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
287 endfunc
30610
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
288
30733
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
289 func Test_smoothscroll_wrap_long_line()
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
290 CheckScreendump
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
291
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
292 let lines =<< trim END
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
293 vim9script
31148
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
294 setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four'])
30733
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
295 set smoothscroll scrolloff=0
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
296 normal 3G10|zt
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
297 END
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
298 call writefile(lines, 'XSmoothWrap', 'D')
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
299 let buf = RunVimInTerminal('-S XSmoothWrap', #{rows: 6, cols: 40})
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
300 call VerifyScreenDump(buf, 'Test_smooth_long_1', {})
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
301
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
302 " scrolling up, cursor moves screen line down
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
303 call term_sendkeys(buf, "\<C-E>")
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
304 call VerifyScreenDump(buf, 'Test_smooth_long_2', {})
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
305 call term_sendkeys(buf, "5\<C-E>")
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
306 call VerifyScreenDump(buf, 'Test_smooth_long_3', {})
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
307
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
308 " scrolling down, cursor moves screen line up
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
309 call term_sendkeys(buf, "5\<C-Y>")
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
310 call VerifyScreenDump(buf, 'Test_smooth_long_4', {})
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
311 call term_sendkeys(buf, "\<C-Y>")
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
312 call VerifyScreenDump(buf, 'Test_smooth_long_5', {})
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
313
30745
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
314 " 'scrolloff' set to 1, scrolling up, cursor moves screen line down
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
315 call term_sendkeys(buf, ":set scrolloff=1\<CR>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
316 call term_sendkeys(buf, "10|\<C-E>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
317 call VerifyScreenDump(buf, 'Test_smooth_long_6', {})
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31829
diff changeset
318
30745
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
319 " 'scrolloff' set to 1, scrolling down, cursor moves screen line up
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
320 call term_sendkeys(buf, "\<C-E>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
321 call term_sendkeys(buf, "gjgj")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
322 call term_sendkeys(buf, "\<C-Y>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
323 call VerifyScreenDump(buf, 'Test_smooth_long_7', {})
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31829
diff changeset
324
30745
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
325 " 'scrolloff' set to 2, scrolling up, cursor moves screen line down
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
326 call term_sendkeys(buf, ":set scrolloff=2\<CR>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
327 call term_sendkeys(buf, "10|\<C-E>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
328 call VerifyScreenDump(buf, 'Test_smooth_long_8', {})
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31829
diff changeset
329
30745
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
330 " 'scrolloff' set to 2, scrolling down, cursor moves screen line up
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
331 call term_sendkeys(buf, "\<C-E>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
332 call term_sendkeys(buf, "gj")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
333 call term_sendkeys(buf, "\<C-Y>")
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
334 call VerifyScreenDump(buf, 'Test_smooth_long_9', {})
31148
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
335
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
336 " 'scrolloff' set to 0, move cursor down one line.
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
337 " Cursor should move properly, and since this is a really long line, it will
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
338 " be put on top of the screen.
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
339 call term_sendkeys(buf, ":set scrolloff=0\<CR>")
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
340 call term_sendkeys(buf, "0j")
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
341 call VerifyScreenDump(buf, 'Test_smooth_long_10', {})
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
342
31577
3c21865e8068 patch 9.0.1121: cursor positioning and display problems with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31333
diff changeset
343 " Test zt/zz/zb that they work properly when a long line is above it
32403
1b0ade08ec91 patch 9.0.1533: test for 'smoothscroll' is ineffective
Bram Moolenaar <Bram@vim.org>
parents: 32387
diff changeset
344 call term_sendkeys(buf, "zt")
31577
3c21865e8068 patch 9.0.1121: cursor positioning and display problems with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31333
diff changeset
345 call VerifyScreenDump(buf, 'Test_smooth_long_11', {})
3c21865e8068 patch 9.0.1121: cursor positioning and display problems with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31333
diff changeset
346 call term_sendkeys(buf, "zz")
3c21865e8068 patch 9.0.1121: cursor positioning and display problems with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31333
diff changeset
347 call VerifyScreenDump(buf, 'Test_smooth_long_12', {})
32403
1b0ade08ec91 patch 9.0.1533: test for 'smoothscroll' is ineffective
Bram Moolenaar <Bram@vim.org>
parents: 32387
diff changeset
348 call term_sendkeys(buf, "zb")
31577
3c21865e8068 patch 9.0.1121: cursor positioning and display problems with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31333
diff changeset
349 call VerifyScreenDump(buf, 'Test_smooth_long_13', {})
3c21865e8068 patch 9.0.1121: cursor positioning and display problems with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31333
diff changeset
350
31148
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
351 " Repeat the step and move the cursor down again.
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
352 " This time, use a shorter long line that is barely long enough to span more
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
353 " than one window. Note that the cursor is at the bottom this time because
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
354 " Vim prefers to do so if we are scrolling a few lines only.
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
355 call term_sendkeys(buf, ":call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])\<CR>")
32423
667d85c09e9c patch 9.0.1543: display errors when making topline shorter
Bram Moolenaar <Bram@vim.org>
parents: 32403
diff changeset
356 " Currently visible lines were replaced, test that the lines and cursor
667d85c09e9c patch 9.0.1543: display errors when making topline shorter
Bram Moolenaar <Bram@vim.org>
parents: 32403
diff changeset
357 " are correctly displayed.
667d85c09e9c patch 9.0.1543: display errors when making topline shorter
Bram Moolenaar <Bram@vim.org>
parents: 32403
diff changeset
358 call VerifyScreenDump(buf, 'Test_smooth_long_14', {})
31148
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
359 call term_sendkeys(buf, "3Gzt")
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
360 call term_sendkeys(buf, "j")
32423
667d85c09e9c patch 9.0.1543: display errors when making topline shorter
Bram Moolenaar <Bram@vim.org>
parents: 32403
diff changeset
361 call VerifyScreenDump(buf, 'Test_smooth_long_15', {})
31148
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
362
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
363 " Repeat the step but this time start it when the line is smooth-scrolled by
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
364 " one line. This tests that the offset calculation is still correct and
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
365 " still end up scrolling down to the next line with cursor at bottom of
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
366 " screen.
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
367 call term_sendkeys(buf, "3Gzt")
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
368 call term_sendkeys(buf, "\<C-E>j")
32423
667d85c09e9c patch 9.0.1543: display errors when making topline shorter
Bram Moolenaar <Bram@vim.org>
parents: 32403
diff changeset
369 call VerifyScreenDump(buf, 'Test_smooth_long_16', {})
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31829
diff changeset
370
30733
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
371 call StopVimInTerminal(buf)
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
372 endfunc
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
373
30799
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
374 func Test_smoothscroll_one_long_line()
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
375 CheckScreendump
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
376
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
377 let lines =<< trim END
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
378 vim9script
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
379 setline(1, 'with lots of text '->repeat(7))
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
380 set smoothscroll scrolloff=0
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
381 END
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
382 call writefile(lines, 'XSmoothOneLong', 'D')
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
383 let buf = RunVimInTerminal('-S XSmoothOneLong', #{rows: 6, cols: 40})
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
384 call VerifyScreenDump(buf, 'Test_smooth_one_long_1', {})
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31829
diff changeset
385
30799
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
386 call term_sendkeys(buf, "\<C-E>")
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
387 call VerifyScreenDump(buf, 'Test_smooth_one_long_2', {})
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
388
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
389 call term_sendkeys(buf, "0")
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
390 call VerifyScreenDump(buf, 'Test_smooth_one_long_1', {})
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
391
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
392 call StopVimInTerminal(buf)
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
393 endfunc
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
394
31127
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
395 func Test_smoothscroll_long_line_showbreak()
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
396 CheckScreendump
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
397
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
398 let lines =<< trim END
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
399 vim9script
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
400 # a line that spans four screen lines
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
401 setline(1, 'with lots of text in one line '->repeat(6))
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
402 set smoothscroll scrolloff=0 showbreak=+++\
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
403 END
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
404 call writefile(lines, 'XSmoothLongShowbreak', 'D')
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
405 let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40})
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
406 call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {})
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31829
diff changeset
407
31127
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
408 call term_sendkeys(buf, "\<C-E>")
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
409 call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_2', {})
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
410
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
411 call term_sendkeys(buf, "0")
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
412 call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {})
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
413
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
414 call StopVimInTerminal(buf)
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
415 endfunc
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
416
32541
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
417 " Check that 'smoothscroll' marker is drawn over double-width char correctly.
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
418 " Run with multiple encodings.
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
419 func Test_smoothscroll_marker_over_double_width()
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
420 " Run this in a separate Vim instance to avoid messing up.
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
421 let after =<< trim [CODE]
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
422 scriptencoding utf-8
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
423 call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
424 setlocal smoothscroll
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
425 redraw
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
426 exe "norm \<C-E>"
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
427 redraw
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
428 " Check the chars one by one. Don't check the whole line concatenated.
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
429 call assert_equal('<', screenstring(1, 1))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
430 call assert_equal('<', screenstring(1, 2))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
431 call assert_equal('<', screenstring(1, 3))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
432 call assert_equal(' ', screenstring(1, 4))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
433 call assert_equal('口', screenstring(1, 5))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
434 call assert_equal('口', screenstring(1, 7))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
435 call assert_equal('口', screenstring(1, 9))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
436 call assert_equal('口', screenstring(1, 11))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
437 call assert_equal('口', screenstring(1, 13))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
438 call assert_equal('口', screenstring(1, 15))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
439 call writefile(v:errors, 'Xresult')
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
440 qall!
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
441 [CODE]
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
442
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
443 let encodings = ['utf-8', 'cp932', 'cp936', 'cp949', 'cp950']
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
444 if !has('win32')
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
445 let encodings += ['euc-jp']
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
446 endif
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
447 for enc in encodings
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
448 let msg = 'enc=' .. enc
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
449 if RunVim([], after, $'--clean --cmd "set encoding={enc}"')
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
450 call assert_equal([], readfile('Xresult'), msg)
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
451 endif
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
452 call delete('Xresult')
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
453 endfor
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
454 endfunc
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
455
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
456 " Same as the test above, but check the text actually shown on screen.
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
457 " Only run with UTF-8 encoding.
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
458 func Test_smoothscroll_marker_over_double_width_dump()
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
459 CheckScreendump
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
460
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
461 let lines =<< trim END
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
462 call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10))
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
463 setlocal smoothscroll
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
464 END
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
465 call writefile(lines, 'XSmoothMarkerOverDoubleWidth', 'D')
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
466 let buf = RunVimInTerminal('-S XSmoothMarkerOverDoubleWidth', #{rows: 6, cols: 40})
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
467 call VerifyScreenDump(buf, 'Test_smooth_marker_over_double_width_1', {})
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
468
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
469 call term_sendkeys(buf, "\<C-E>")
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
470 call VerifyScreenDump(buf, 'Test_smooth_marker_over_double_width_2', {})
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
471
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
472 call StopVimInTerminal(buf)
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
473 endfunc
75e56c94316d patch 9.0.1602: stray character visible if marker on top of double-wide char
Bram Moolenaar <Bram@vim.org>
parents: 32473
diff changeset
474
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
475 func s:check_col_calc(win_col, win_line, buf_col)
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
476 call assert_equal(a:win_col, wincol())
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
477 call assert_equal(a:win_line, winline())
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
478 call assert_equal(a:buf_col, col('.'))
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
479 endfunc
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
480
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
481 " Test that if the current cursor is on a smooth scrolled line, we correctly
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
482 " reposition it. Also check that we don't miscalculate the values by checking
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
483 " the consistency between wincol() and col('.') as they are calculated
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
484 " separately in code.
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
485 func Test_smoothscroll_cursor_position()
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
486 call NewWindow(10, 20)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
487 setl smoothscroll wrap
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
488 call setline(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
489
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
490 call s:check_col_calc(1, 1, 1)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
491 exe "normal \<C-E>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
492
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
493 " Move down another line to avoid blocking the <<< display
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
494 call s:check_col_calc(1, 2, 41)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
495 exe "normal \<C-Y>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
496 call s:check_col_calc(1, 3, 41)
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
497
32427
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
498 " Test "g0/g<Home>"
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
499 exe "normal gg\<C-E>"
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
500 norm $gkg0
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
501 call s:check_col_calc(1, 2, 21)
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
502
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
503 " Test moving the cursor behind the <<< display with 'virtualedit'
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
504 set virtualedit=all
32439
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
505 exe "normal \<C-E>3lgkh"
32427
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
506 call s:check_col_calc(3, 2, 23)
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
507 set virtualedit&
11bc7fa31c3b patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"
Bram Moolenaar <Bram@vim.org>
parents: 32423
diff changeset
508
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
509 normal gg3l
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
510 exe "normal \<C-E>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
511
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
512 " Move down only 1 line when we are out of the range of the <<< display
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
513 call s:check_col_calc(4, 1, 24)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
514 exe "normal \<C-Y>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
515 call s:check_col_calc(4, 2, 24)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
516 normal ggg$
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
517 exe "normal \<C-E>"
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
518 call s:check_col_calc(20, 1, 40)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
519 exe "normal \<C-Y>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
520 call s:check_col_calc(20, 2, 40)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
521 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
522
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
523 " Test number, where we have indented lines
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
524 setl number
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
525 call s:check_col_calc(5, 1, 1)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
526 exe "normal \<C-E>"
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
527
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
528 " Move down only 1 line when the <<< display is on the number column
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
529 call s:check_col_calc(5, 1, 17)
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
530 exe "normal \<C-Y>"
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
531 call s:check_col_calc(5, 2, 17)
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
532 normal ggg$
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
533 exe "normal \<C-E>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
534 call s:check_col_calc(20, 1, 32)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
535 exe "normal \<C-Y>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
536 call s:check_col_calc(20, 2, 32)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
537 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
538
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
539 setl numberwidth=1
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
540
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
541 " Move down another line when numberwidth is too short to cover the whole
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
542 " <<< display
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
543 call s:check_col_calc(3, 1, 1)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
544 exe "normal \<C-E>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
545 call s:check_col_calc(3, 2, 37)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
546 exe "normal \<C-Y>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
547 call s:check_col_calc(3, 3, 37)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
548 normal ggl
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
549
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
550 " Only move 1 line down when we are just past the <<< display
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
551 call s:check_col_calc(4, 1, 2)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
552 exe "normal \<C-E>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
553 call s:check_col_calc(4, 1, 20)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
554 exe "normal \<C-Y>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
555 call s:check_col_calc(4, 2, 20)
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
556 normal gg
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
557 setl numberwidth&
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
558
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
559 " Test number + showbreak, so test that the additional indentation works
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
560 setl number showbreak=+++
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
561 call s:check_col_calc(5, 1, 1)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
562 exe "normal \<C-E>"
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
563 call s:check_col_calc(8, 1, 17)
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
564 exe "normal \<C-Y>"
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
565 call s:check_col_calc(8, 2, 17)
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
566 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
567
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
568 " Test number + cpo+=n mode, where wrapped lines aren't indented
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
569 setl number cpo+=n showbreak=
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
570 call s:check_col_calc(5, 1, 1)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
571 exe "normal \<C-E>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
572 call s:check_col_calc(1, 2, 37)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
573 exe "normal \<C-Y>"
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
574 call s:check_col_calc(1, 3, 37)
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
575 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
576
32439
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
577 " Test list + listchars "precedes", where there is always 1 overlap
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
578 " regardless of number and cpo-=n.
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
579 setl number list listchars=precedes:< cpo-=n
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
580 call s:check_col_calc(5, 1, 1)
32460
45c426cebfcd patch 9.0.1561: display wrong when moving cursor to above the top line
Bram Moolenaar <Bram@vim.org>
parents: 32439
diff changeset
581 exe "normal 3|\<C-E>h"
32439
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
582 call s:check_col_calc(6, 1, 18)
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
583 norm h
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
584 call s:check_col_calc(5, 2, 17)
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
585 normal gg
9d072cccc8fc patch 9.0.1551: position of marker for 'smoothscroll' not computed correctly
Bram Moolenaar <Bram@vim.org>
parents: 32427
diff changeset
586
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
587 bwipe!
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
588 endfunc
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
589
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
590 func Test_smoothscroll_cursor_scrolloff()
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
591 call NewWindow(10, 20)
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
592 setl smoothscroll wrap
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
593 setl scrolloff=3
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31829
diff changeset
594
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
595 " 120 chars are 6 screen lines
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
596 call setline(1, "abcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRST")
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
597 call setline(2, "below")
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
598
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
599 call s:check_col_calc(1, 1, 1)
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
600
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
601 " CTRL-E shows "<<<DEFG...", cursor move four lines down
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
602 exe "normal \<C-E>"
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
603 call s:check_col_calc(1, 4, 81)
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
604
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
605 " cursor on start of second line, "gk" moves into first line, skipcol doesn't
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
606 " change
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
607 exe "normal G0gk"
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
608 call s:check_col_calc(1, 5, 101)
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
609
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
610 " move cursor left one window width worth, scrolls one screen line
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
611 exe "normal 20h"
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
612 call s:check_col_calc(1, 5, 81)
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
613
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
614 " move cursor left one window width worth, scrolls one screen line
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
615 exe "normal 20h"
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
616 call s:check_col_calc(1, 4, 61)
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
617
31333
bfbcc148da58 patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Bram Moolenaar <Bram@vim.org>
parents: 31329
diff changeset
618 " cursor on last line, "gk" should not cause a scroll
bfbcc148da58 patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Bram Moolenaar <Bram@vim.org>
parents: 31329
diff changeset
619 set scrolloff=0
bfbcc148da58 patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Bram Moolenaar <Bram@vim.org>
parents: 31329
diff changeset
620 normal G0
bfbcc148da58 patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Bram Moolenaar <Bram@vim.org>
parents: 31329
diff changeset
621 call s:check_col_calc(1, 7, 1)
bfbcc148da58 patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Bram Moolenaar <Bram@vim.org>
parents: 31329
diff changeset
622 normal gk
bfbcc148da58 patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Bram Moolenaar <Bram@vim.org>
parents: 31329
diff changeset
623 call s:check_col_calc(1, 6, 101)
bfbcc148da58 patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Bram Moolenaar <Bram@vim.org>
parents: 31329
diff changeset
624
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
625 bwipe!
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
626 endfunc
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
627
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
628
31154
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
629 " Test that mouse picking is still accurate when we have smooth scrolled lines
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
630 func Test_smoothscroll_mouse_pos()
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
631 CheckNotGui
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
632 CheckUnix
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
633
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
634 let save_mouse = &mouse
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
635 let save_term = &term
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
636 let save_ttymouse = &ttymouse
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
637 set mouse=a term=xterm ttymouse=xterm2
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
638
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
639 call NewWindow(10, 20)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
640 setl smoothscroll wrap
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
641 " First line will wrap to 3 physical lines. 2nd/3rd lines are short lines.
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
642 call setline(1, ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "line 2", "line 3"])
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
643
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
644 func s:check_mouse_click(row, col, buf_row, buf_col)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
645 call MouseLeftClick(a:row, a:col)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
646
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
647 call assert_equal(a:col, wincol())
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
648 call assert_equal(a:row, winline())
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
649 call assert_equal(a:buf_row, line('.'))
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
650 call assert_equal(a:buf_col, col('.'))
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
651 endfunc
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
652
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
653 " Check that clicking without scroll works first.
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
654 call s:check_mouse_click(3, 5, 1, 45)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
655 call s:check_mouse_click(4, 1, 2, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
656 call s:check_mouse_click(4, 6, 2, 6)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
657 call s:check_mouse_click(5, 1, 3, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
658 call s:check_mouse_click(5, 6, 3, 6)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
659
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
660 " Smooth scroll, and checks that this didn't mess up mouse clicking
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
661 exe "normal \<C-E>"
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
662 call s:check_mouse_click(2, 5, 1, 45)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
663 call s:check_mouse_click(3, 1, 2, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
664 call s:check_mouse_click(3, 6, 2, 6)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
665 call s:check_mouse_click(4, 1, 3, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
666 call s:check_mouse_click(4, 6, 3, 6)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
667
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
668 exe "normal \<C-E>"
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
669 call s:check_mouse_click(1, 5, 1, 45)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
670 call s:check_mouse_click(2, 1, 2, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
671 call s:check_mouse_click(2, 6, 2, 6)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
672 call s:check_mouse_click(3, 1, 3, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
673 call s:check_mouse_click(3, 6, 3, 6)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
674
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
675 " Make a new first line 11 physical lines tall so it's taller than window
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
676 " height, to test overflow calculations with really long lines wrapping.
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
677 normal gg
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
678 call setline(1, "12345678901234567890"->repeat(11))
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
679 exe "normal 6\<C-E>"
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
680 call s:check_mouse_click(5, 1, 1, 201)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
681 call s:check_mouse_click(6, 1, 2, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
682 call s:check_mouse_click(7, 1, 3, 1)
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
683
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
684 let &mouse = save_mouse
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
685 let &term = save_term
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
686 let &ttymouse = save_ttymouse
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
687 endfunc
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
688
31829
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
689 " this was dividing by zero
32361
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
690 func Test_smoothscroll_zero_width()
31829
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
691 CheckScreendump
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
692
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
693 let lines =<< trim END
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
694 winsize 0 0
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
695 vsplit
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
696 vsplit
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
697 vsplit
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
698 vsplit
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
699 vsplit
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
700 sil norm H
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
701 set wrap
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
702 set smoothscroll
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
703 set number
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
704 END
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
705 call writefile(lines, 'XSmoothScrollZero', 'D')
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
706 let buf = RunVimInTerminal('-u NONE -i NONE -n -m -X -Z -e -s -S XSmoothScrollZero', #{rows: 6, cols: 60, wait_for_ruler: 0})
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
707 call VerifyScreenDump(buf, 'Test_smoothscroll_zero_1', {})
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
708
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
709 call term_sendkeys(buf, ":sil norm \<C-V>\<C-W>\<C-V>\<C-N>\<CR>")
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
710 call VerifyScreenDump(buf, 'Test_smoothscroll_zero_2', {})
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
711
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
712 call StopVimInTerminal(buf)
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
713 endfunc
2a590b4a3fba patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Bram Moolenaar <Bram@vim.org>
parents: 31577
diff changeset
714
32361
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
715 " this was unnecessarily inserting lines
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
716 func Test_smoothscroll_ins_lines()
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
717 CheckScreendump
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
718
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
719 let lines =<< trim END
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
720 set wrap
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
721 set smoothscroll
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
722 set scrolloff=0
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
723 set conceallevel=2
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
724 call setline(1, [
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
725 \'line one' .. 'with lots of text in one line '->repeat(2),
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
726 \'line two',
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
727 \'line three',
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
728 \'line four',
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
729 \'line five'
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
730 \])
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
731 END
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
732 call writefile(lines, 'XSmoothScrollInsLines', 'D')
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
733 let buf = RunVimInTerminal('-S XSmoothScrollInsLines', #{rows: 6, cols: 40})
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
734
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
735 call term_sendkeys(buf, "\<C-E>gjgk")
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
736 call VerifyScreenDump(buf, 'Test_smooth_ins_lines', {})
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
737
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
738 call StopVimInTerminal(buf)
9ac987a467d5 patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32349
diff changeset
739 endfunc
30610
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
740
32387
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
741 " this placed the cursor in the command line
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
742 func Test_smoothscroll_cursormoved_line()
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
743 CheckScreendump
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
744
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
745 let lines =<< trim END
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
746 set smoothscroll
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
747 call setline(1, [
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
748 \'',
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
749 \'_'->repeat(&lines * &columns),
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
750 \(('_')->repeat(&columns - 2) .. 'xxx')->repeat(2)
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
751 \])
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
752 autocmd CursorMoved * eval [line('w0'), line('w$')]
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
753 call search('xxx')
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
754 END
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
755 call writefile(lines, 'XSmoothCursorMovedLine', 'D')
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
756 let buf = RunVimInTerminal('-S XSmoothCursorMovedLine', #{rows: 6})
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
757
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
758 call VerifyScreenDump(buf, 'Test_smooth_cursormoved_line', {})
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
759
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
760 call StopVimInTerminal(buf)
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
761 endfunc
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
762
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
763 func Test_smoothscroll_eob()
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
764 CheckScreendump
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
765
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
766 let lines =<< trim END
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
767 set smoothscroll
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
768 call setline(1, ['']->repeat(100))
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
769 norm G
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
770 END
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
771 call writefile(lines, 'XSmoothEob', 'D')
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
772 let buf = RunVimInTerminal('-S XSmoothEob', #{rows: 10})
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
773
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
774 " does not scroll halfway when scrolling to end of buffer
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
775 call VerifyScreenDump(buf, 'Test_smooth_eob_1', {})
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
776
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
777 " cursor is not placed below window
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
778 call term_sendkeys(buf, ":call setline(92, 'a'->repeat(100))\<CR>\<C-B>G")
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
779 call VerifyScreenDump(buf, 'Test_smooth_eob_2', {})
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
780
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
781 call StopVimInTerminal(buf)
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
782 endfunc
1ddef52ea786 patch 9.0.1525: 'smoothscroll' does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 32365
diff changeset
783
32473
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
784 " skipcol should not reset when doing incremental search on the same word
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
785 func Test_smoothscroll_incsearch()
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
786 CheckScreendump
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
787
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
788 let lines =<< trim END
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
789 set smoothscroll number scrolloff=0 incsearch
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
790 call setline(1, repeat([''], 20))
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
791 call setline(11, repeat('a', 100))
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
792 call setline(14, 'bbbb')
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
793 END
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
794 call writefile(lines, 'XSmoothIncsearch', 'D')
32543
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
795 let buf = RunVimInTerminal('-S XSmoothIncsearch', #{rows: 8, cols: 40})
32473
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
796
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
797 call term_sendkeys(buf, "/b")
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
798 call VerifyScreenDump(buf, 'Test_smooth_incsearch_1', {})
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
799 call term_sendkeys(buf, "b")
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
800 call VerifyScreenDump(buf, 'Test_smooth_incsearch_2', {})
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
801 call term_sendkeys(buf, "b")
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
802 call VerifyScreenDump(buf, 'Test_smooth_incsearch_3', {})
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
803 call term_sendkeys(buf, "b")
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
804 call VerifyScreenDump(buf, 'Test_smooth_incsearch_4', {})
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
805 call term_sendkeys(buf, "\<CR>")
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
806
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
807 call StopVimInTerminal(buf)
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
808 endfunc
c89816c3e2d7 patch 9.0.1568: with 'smoothscroll' cursor may move below botline
Bram Moolenaar <Bram@vim.org>
parents: 32460
diff changeset
809
32543
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
810 " Test scrolling multiple lines and stopping at non-zero skipcol.
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
811 func Test_smoothscroll_multi_skipcol()
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
812 CheckScreendump
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
813
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
814 let lines =<< trim END
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
815 setlocal cursorline scrolloff=0 smoothscroll
32557
e64d1fd43178 patch 9.0.1610: display is wrong when 'smoothscroll' is set
Bram Moolenaar <Bram@vim.org>
parents: 32543
diff changeset
816 call setline(1, repeat([''], 8))
32543
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
817 call setline(3, repeat('a', 50))
32557
e64d1fd43178 patch 9.0.1610: display is wrong when 'smoothscroll' is set
Bram Moolenaar <Bram@vim.org>
parents: 32543
diff changeset
818 call setline(4, repeat('a', 50))
e64d1fd43178 patch 9.0.1610: display is wrong when 'smoothscroll' is set
Bram Moolenaar <Bram@vim.org>
parents: 32543
diff changeset
819 call setline(7, 'bbb')
e64d1fd43178 patch 9.0.1610: display is wrong when 'smoothscroll' is set
Bram Moolenaar <Bram@vim.org>
parents: 32543
diff changeset
820 call setline(8, 'ccc')
32543
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
821 redraw
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
822 END
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
823 call writefile(lines, 'XSmoothMultiSkipcol', 'D')
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
824 let buf = RunVimInTerminal('-S XSmoothMultiSkipcol', #{rows: 10, cols: 40})
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
825 call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_1', {})
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
826
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
827 call term_sendkeys(buf, "3\<C-E>")
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
828 call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_2', {})
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
829
32557
e64d1fd43178 patch 9.0.1610: display is wrong when 'smoothscroll' is set
Bram Moolenaar <Bram@vim.org>
parents: 32543
diff changeset
830 call term_sendkeys(buf, "2\<C-E>")
e64d1fd43178 patch 9.0.1610: display is wrong when 'smoothscroll' is set
Bram Moolenaar <Bram@vim.org>
parents: 32543
diff changeset
831 call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_3', {})
e64d1fd43178 patch 9.0.1610: display is wrong when 'smoothscroll' is set
Bram Moolenaar <Bram@vim.org>
parents: 32543
diff changeset
832
32543
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
833 call StopVimInTerminal(buf)
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
834 endfunc
ca42967a3253 patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 32541
diff changeset
835
32665
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
836 " this was dividing by zero bug in scroll_cursor_bot
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
837 func Test_smoothscroll_zero_width_scroll_cursor_bot()
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
838 CheckScreendump
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
839
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
840 let lines =<< trim END
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
841 silent normal yy
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
842 silent normal 19p
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
843 winsize 0 19
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
844 vsplit
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
845 vertical resize 0
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
846 set foldcolumn=1
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
847 set number
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
848 set smoothscroll
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
849 silent normal 20G
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
850 END
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
851 call writefile(lines, 'XSmoothScrollZeroBot', 'D')
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
852 let buf = RunVimInTerminal('-u NONE -S XSmoothScrollZeroBot', #{rows: 19, wait_for_ruler: 0})
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
853 call TermWait(buf, 1000)
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
854
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
855 call VerifyScreenDump(buf, 'Test_smoothscroll_zero_bot', {})
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
856
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
857 call StopVimInTerminal(buf)
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
858 endfunc
23e24f3cae03 patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Bram Moolenaar <Bram@vim.org>
parents: 32561
diff changeset
859
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 12718
diff changeset
860 " vim: shiftwidth=2 sts=2 expandtab