annotate src/testdir/test_scroll_opt.vim @ 31329:5c83140aafc9 v9.0.0998

patch 9.0.0998: "gk" may reset skipcol when not needed Commit: https://github.com/vim/vim/commit/1b73edd9ee40aec400f3611f59823cec5fd1c489 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 3 11:51:54 2022 +0000 patch 9.0.0998: "gk" may reset skipcol when not needed Problem: "gk" may reset skipcol when not needed. Solution: Only reset skipcol if the cursor column is less.
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Dec 2022 13:00:04 +0100
parents 7e48ddb8b079
children bfbcc148da58
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
30620
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
41 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
42 enew
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
43 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
44 set number
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
45 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
46 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
47 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
48 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
49
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
50 bwipe!
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
51 set nonumber
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
52 endfunc
70d6345a2976 patch 9.0.0645: CTRL-Y does not stop at line 1
Bram Moolenaar <Bram@vim.org>
parents: 30610
diff changeset
53
30610
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
54 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
55 CheckScreendump
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
56
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
57 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
58 vim9script
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
59 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
60 '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
61 '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
62 '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
63 '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
64 'line',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
65 'line',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
66 'line',
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
67 ])
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
68 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
69 :5
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
70 END
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
71 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
72 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
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 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
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
83 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
84 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
85 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
86 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
87 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
88 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
89 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
90 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
91
30622
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
92 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
93 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
94 " 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104 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
105 endif
ffd6e3bd65b8 patch 9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set
Bram Moolenaar <Bram@vim.org>
parents: 30620
diff changeset
106
30610
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 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
108 endfunc
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
109
30635
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
110 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
111 CheckScreendump
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
112
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
113 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
114 vim9script
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
115 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
116 '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
117 '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
118 'line',
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
119 'line',
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
120 'line',
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
121 ])
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
122 set smoothscroll
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
123 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
124 :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
125
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
126 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
127 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
128 :%del
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
129 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
130 'one',
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
131 '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
132 'three',
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
133 ])
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
134 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
135 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
136 END
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
137 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
138 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
139
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
140 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
141 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
142 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
143 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
144 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
145
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
146 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
147 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
148 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
149 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
150 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
151 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
152
30845
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
153 call term_sendkeys(buf, ":call DoRel()\<CR>")
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
154 call VerifyScreenDump(buf, 'Test_smooth_number_7', {})
fa3aba805a34 patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Bram Moolenaar <Bram@vim.org>
parents: 30799
diff changeset
155
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 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
157 endfunc
604d7d7aa043 patch 9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30622
diff changeset
158
30847
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
159 func Test_smoothscroll_list()
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
160 CheckScreendump
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
161
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
162 let lines =<< trim END
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
163 vim9script
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
164 set smoothscroll scrolloff=0
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
165 set list
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
166 setline(1, [
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
167 'one',
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
168 'very long text '->repeat(12),
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
169 'three',
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
170 ])
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
171 exe "normal 2Gzt\<C-E>"
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
172 END
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
173 call writefile(lines, 'XSmoothList', 'D')
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
174 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
175
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
176 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
177
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
178 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
179 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
180
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
181 call StopVimInTerminal(buf)
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
182 endfunc
2c03ff81cbcb patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Bram Moolenaar <Bram@vim.org>
parents: 30845
diff changeset
183
30673
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
184 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
185 CheckScreendump
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
186
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
187 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
188 vim9script
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
189 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
190 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
191 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
192 diffthis
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
193 new
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
194 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
195 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
196 diffthis
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
197 END
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
198 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
199 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
200
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
201 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
202 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
203 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
204 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
205 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
206
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
207 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
208 endfunc
53b826c4649f patch 9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Bram Moolenaar <Bram@vim.org>
parents: 30635
diff changeset
209
30675
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
210 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
211 CheckScreendump
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
212
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
213 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
214 vim9script
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
215 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
216 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
217 :3
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
218 END
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
219 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
220 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
221
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
222 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
223
30677
a345ad853b08 patch 9.0.0673: first line wong with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30675
diff changeset
224 " 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
225 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
226 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
227
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
228 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
229 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
230
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
231 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
232 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
233
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
234 " moving cursor up right after the >>> marker - no need to show whole line
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
235 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
236 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
237
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
238 " moving cursor up where the >>> marker is - whole top line shows
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
239 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
240 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
241
30675
bc48f3752d8d patch 9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Bram Moolenaar <Bram@vim.org>
parents: 30673
diff changeset
242 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
243 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
244
30733
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
245 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
246 CheckScreendump
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
247
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
248 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
249 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
250 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
251 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
252 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
253 END
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
254 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
255 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
256 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
257
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
258 " 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
259 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
260 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
261 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
262 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
263
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
264 " 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
265 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
266 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
267 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
268 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
269
30745
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
270 " '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
271 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
272 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
273 call VerifyScreenDump(buf, 'Test_smooth_long_6', {})
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
274
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
275 " '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
276 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
277 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
278 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
279 call VerifyScreenDump(buf, 'Test_smooth_long_7', {})
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
280
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
281 " '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
282 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
283 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
284 call VerifyScreenDump(buf, 'Test_smooth_long_8', {})
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
285
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
286 " '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
287 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
288 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
289 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
290 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
291
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
292 " '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
293 " 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
294 " 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
295 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
296 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
297 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
298
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
299 " 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
300 " 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
301 " 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
302 " 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
303 call term_sendkeys(buf, ":call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])\<CR>")
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
304 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
305 call term_sendkeys(buf, "j")
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
306 call VerifyScreenDump(buf, 'Test_smooth_long_11', {})
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
307
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
308 " 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
309 " 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
310 " 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
311 " screen.
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
312 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
313 call term_sendkeys(buf, "\<C-E>j")
69cea3380d9a patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31131
diff changeset
314 call VerifyScreenDump(buf, 'Test_smooth_long_12', {})
30745
fdc44acc3250 patch 9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30733
diff changeset
315
30733
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
316 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
317 endfunc
5bea8e583d28 patch 9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Bram Moolenaar <Bram@vim.org>
parents: 30677
diff changeset
318
30799
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
319 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
320 CheckScreendump
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
321
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
322 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
323 vim9script
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
324 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
325 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
326 END
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
327 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
328 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
329 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
330
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
331 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
332 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
333
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
334 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
335 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
336
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
337 call StopVimInTerminal(buf)
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
338 endfunc
ffa5492137c3 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 30745
diff changeset
339
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
340 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
341 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
342
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
343 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
344 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
345 # 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
346 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
347 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
348 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
349 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
350 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
351 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
352
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
353 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
354 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
355
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
356 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
357 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
358
92b929203a4f patch 9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Bram Moolenaar <Bram@vim.org>
parents: 31117
diff changeset
359 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
360 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
361
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
362 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
363 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
364 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
365 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
366 endfunc
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
367
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
368 " 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
369 " 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
370 " 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
371 " 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
372 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
373 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
374 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
375 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
376
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
377 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
378 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
379
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
380 " 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
381 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
382 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
383 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
384
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
385 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
386 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
387
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
388 " 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
389 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
390 exe "normal \<C-Y>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
391 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
392 normal ggg$
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
393 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
394 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
395 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
396 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
397 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
398
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
399 " 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
400 setl number
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
401 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
402 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
403
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
404 " 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
405 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
406 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
407 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
408 normal ggg$
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
409 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
410 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
411 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
412 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
413 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
414
31131
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
415 setl numberwidth=1
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
416
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
417 " 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
418 " <<< display
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
419 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
420 exe "normal \<C-E>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
421 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
422 exe "normal \<C-Y>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
423 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
424 normal ggl
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
425
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
426 " 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
427 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
428 exe "normal \<C-E>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
429 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
430 exe "normal \<C-Y>"
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
431 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
432 normal gg
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
433 setl numberwidth&
8de082110e2d patch 9.0.0900: cursor moves too far with 'smoothscroll'
Bram Moolenaar <Bram@vim.org>
parents: 31127
diff changeset
434
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
435 " 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
436 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
437 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
438 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
439 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
440 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
441 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
442 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
443
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
444 " 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
445 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
446 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
447 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
448 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
449 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
450 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
451 normal gg
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
452
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
453 bwipe!
31117
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
454 endfunc
a5bf86083558 patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30847
diff changeset
455
31329
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
456 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
457 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
458 setl smoothscroll wrap
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
459 setl scrolloff=3
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
460
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
461 " 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
462 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
463 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
464
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
465 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
466
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
467 " 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
468 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
469 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
470
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
471 " 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
472 " change
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
473 exe "normal G0gk"
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
474 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
475
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
476 " 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
477 exe "normal 20h"
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
478 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
479
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
480 " 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
481 exe "normal 20h"
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
482 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
483
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
484 bwipe!
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
485 endfunc
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
486
5c83140aafc9 patch 9.0.0998: "gk" may reset skipcol when not needed
Bram Moolenaar <Bram@vim.org>
parents: 31154
diff changeset
487
31154
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
488 " 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
489 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
490 CheckNotGui
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
491 CheckUnix
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
492
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
493 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
494 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
495 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
496 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
497
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
498 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
499 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
500 " 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
501 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
502
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
503 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
504 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
505
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
506 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
507 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
508 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
509 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
510 endfunc
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
511
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
512 " 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
513 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
514 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
515 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
516 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
517 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
518
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
519 " 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
520 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
521 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
522 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
523 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
524 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
525 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
526
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
527 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
528 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
529 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
530 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
531 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
532 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
533
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
534 " 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
535 " 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
536 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
537 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
538 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
539 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
540 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
541 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
542
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
543 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
544 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
545 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
546 endfunc
7e48ddb8b079 patch 9.0.0911: with 'smoothscroll' set mouse click position may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 31148
diff changeset
547
30610
6c6ac189a05f patch 9.0.0640: cannot scroll by screen line if a line wraps
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
548
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 12718
diff changeset
549 " vim: shiftwidth=2 sts=2 expandtab