annotate src/testdir/test_number.vim @ 30582:72245f9c9405 v9.0.0626

patch 9.0.0626: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/b152b6a40f729ed81a25d2fa541a4e73e201bec4 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 29 21:37:33 2022 +0100 patch 9.0.0626: too many delete() calls in tests Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
author Bram Moolenaar <Bram@vim.org>
date Thu, 29 Sep 2022 22:45:04 +0200
parents c99005ffa8c3
children 218363931f5d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10940
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for 'number' and 'relativenumber'
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
3 source check.vim
10940
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 source view_util.vim
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
6 source screendump.vim
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
7
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10940
diff changeset
8 func s:screen_lines(start, end) abort
10940
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 return ScreenLines([a:start, a:end], 8)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10940
diff changeset
12 func s:compare_lines(expect, actual)
10940
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal(a:expect, a:actual)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10940
diff changeset
16 func s:test_windows(h, w) abort
10940
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call NewWindow(a:h, a:w)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10940
diff changeset
20 func s:close_windows() abort
10940
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call CloseWindow()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10940
diff changeset
24 func s:validate_cursor() abort
10940
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " update skipcol.
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " wincol():
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " f_wincol
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 " -> validate_cursor
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " -> curs_columns
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call wincol()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 func Test_set_options()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 set nu rnu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal(1, &nu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal(1, &rnu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call s:test_windows(10, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call assert_equal(1, &nu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal(1, &rnu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 set nu& rnu&
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 func Test_set_global_and_local()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 " setlocal must NOT reset the other global value
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 set nonu nornu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 setglobal nu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 setlocal rnu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call assert_equal(1, &g:nu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 set nonu nornu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 setglobal rnu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 setlocal nu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 call assert_equal(1, &g:rnu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 " setglobal MUST reset the other global value
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 set nonu nornu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 setglobal nu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 setglobal rnu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call assert_equal(1, &g:nu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 set nonu nornu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 setglobal rnu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 setglobal nu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 call assert_equal(1, &g:rnu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 " set MUST reset the other global value
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 set nonu nornu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 set nu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 set rnu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal(1, &g:nu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 set nonu nornu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 set rnu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 set nu
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal(1, &g:rnu)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 set nu& rnu&
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 func Test_number()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call s:test_windows(10, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN", "OPQRSTUVWX", "YZ"])
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 setl number
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 let lines = s:screen_lines(1, 4)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 \ " 1 abcd",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 \ " 2 klmn",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 \ " 3 uvwx",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 \ " 4 EFGH",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 func Test_relativenumber()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 call s:test_windows(10, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN", "OPQRSTUVWX", "YZ"])
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 3
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 setl relativenumber
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 let lines = s:screen_lines(1, 6)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 \ " 2 abcd",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 \ " 1 klmn",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 \ " 0 uvwx",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 \ " 1 EFGH",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 \ " 2 OPQR",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 \ " 3 YZ ",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 func Test_number_with_relativenumber()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 call s:test_windows(10, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN", "OPQRSTUVWX", "YZ"])
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 4
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 setl number relativenumber
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 let lines = s:screen_lines(1, 6)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 \ " 3 abcd",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 \ " 2 klmn",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 \ " 1 uvwx",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 \ "4 EFGH",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 \ " 1 OPQR",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 \ " 2 YZ ",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 func Test_number_with_linewrap1()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 call s:test_windows(3, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 normal! 61ia
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 setl number wrap
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call s:validate_cursor()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 let lines = s:screen_lines(1, 3)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 \ "--1 aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 \ " aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 \ " aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 " Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 func XTest_number_with_linewrap2()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call s:test_windows(3, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 normal! 61ia
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 setl number wrap
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 call s:validate_cursor()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 0
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call s:validate_cursor()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 let lines = s:screen_lines(1, 3)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 \ " 1 aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 \ " aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 \ " aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 " Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 func XTest_number_with_linewrap3()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 call s:test_windows(4, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 normal! 81ia
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 setl number wrap
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 call s:validate_cursor()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 setl nonumber
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 call s:validate_cursor()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 let lines = s:screen_lines(1, 4)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 \ "aaaaaaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 \ "aaaaaaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 \ "aaaaaaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 \ "a ",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 func Test_numberwidth()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 call s:test_windows(10, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 call setline(1, repeat(['aaaa'], 10))
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 setl number numberwidth=6
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 let lines = s:screen_lines(1, 3)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 \ " 1 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 \ " 2 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 \ " 3 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 set relativenumber
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 let lines = s:screen_lines(1, 3)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 \ "1 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 \ " 1 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 \ " 2 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 set nonumber
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 let lines = s:screen_lines(1, 3)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 \ " 0 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 \ " 1 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 \ " 2 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 endfunc
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 func Test_numberwidth_adjusted()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 call s:test_windows(10, 20)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 call setline(1, repeat(['aaaa'], 10000))
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 setl number numberwidth=4
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 let lines = s:screen_lines(1, 3)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 \ " 1 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 \ " 2 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 \ " 3 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 $
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 let lines = s:screen_lines(8, 10)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 \ " 9998 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 \ " 9999 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 \ "10000 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 setl relativenumber
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 let lines = s:screen_lines(8, 10)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 \ " 2 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 \ " 1 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 \ "10000 aa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 setl nonumber
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 let lines = s:screen_lines(8, 10)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 let expect = [
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 \ " 2 aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 \ " 1 aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 \ " 0 aaaa",
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 \ ]
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 call s:compare_lines(expect, lines)
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 call s:close_windows()
a479b7064550 patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 endfunc
17286
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
258
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
259 " This was causing a memcheck error
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
260 func Test_relativenumber_uninitialised()
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
261 new
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
262 set rnu
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
263 call setline(1, ["a", "b"])
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
264 redraw
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
265 call feedkeys("j", 'xt')
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
266 redraw
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
267 bwipe!
a513b81d3689 patch 8.1.1642: may use uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
268 endfunc
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
269
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
270 func Test_relativenumber_colors()
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
271 CheckScreendump
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
272
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
273 let lines =<< trim [CODE]
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
274 call setline(1, range(200))
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
275 111
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
276 set number relativenumber
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
277 hi LineNr ctermfg=red
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
278 [CODE]
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
279 call writefile(lines, 'XTest_relnr', 'D')
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
280
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
281 " Check that the balloon shows up after a mouse move
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
282 let buf = RunVimInTerminal('-S XTest_relnr', {'rows': 10, 'cols': 50})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19495
diff changeset
283 call TermWait(buf, 50)
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
284 " Default colors
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
285 call VerifyScreenDump(buf, 'Test_relnr_colors_1', {})
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
286
19495
f6c87afa5501 patch 8.2.0305: relativenumber test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
287 call term_sendkeys(buf, ":hi LineNrAbove ctermfg=blue\<CR>:\<CR>")
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
288 call VerifyScreenDump(buf, 'Test_relnr_colors_2', {})
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
289
19495
f6c87afa5501 patch 8.2.0305: relativenumber test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
290 call term_sendkeys(buf, ":hi LineNrBelow ctermfg=green\<CR>:\<CR>")
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
291 call VerifyScreenDump(buf, 'Test_relnr_colors_3', {})
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
292
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
293 call term_sendkeys(buf, ":hi clear LineNrAbove\<CR>")
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
294 call VerifyScreenDump(buf, 'Test_relnr_colors_4', {})
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
295
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
296 " clean up
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
297 call StopVimInTerminal(buf)
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 17286
diff changeset
298 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
299
28224
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
300 func Test_relativenumber_callback()
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
301 CheckScreendump
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
302 CheckFeature timers
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
303
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
304 let lines =<< trim END
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
305 call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
306 set relativenumber
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
307 call cursor(4, 1)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
308
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
309 func Func(timer)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
310 call cursor(1, 1)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
311 endfunc
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
312
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
313 call timer_start(300, 'Func')
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
314 END
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
315 call writefile(lines, 'Xrnu_timer', 'D')
28224
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
316
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
317 let buf = RunVimInTerminal('-S Xrnu_timer', #{rows: 8})
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
318 call TermWait(buf, 310)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
319 call VerifyScreenDump(buf, 'Test_relativenumber_callback_1', {})
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
320
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
321 call StopVimInTerminal(buf)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
322 endfunc
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25642
diff changeset
323
24950
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
324 " Test for displaying line numbers with 'rightleft'
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
325 func Test_number_rightleft()
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
326 CheckFeature rightleft
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
327 new
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
328 setlocal number
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
329 setlocal rightleft
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
330 call setline(1, range(1, 1000))
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
331 normal! 9Gzt
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
332 redraw!
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
333 call assert_match('^\s\+9 9$', Screenline(1))
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
334 normal! 10Gzt
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
335 redraw!
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
336 call assert_match('^\s\+01 10$', Screenline(1))
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
337 normal! 100Gzt
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
338 redraw!
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
339 call assert_match('^\s\+001 100$', Screenline(1))
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
340 normal! 1000Gzt
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
341 redraw!
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
342 call assert_match('^\s\+0001 1000$', Screenline(1))
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
343 bw!
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
344 endfunc
18a00b2b9c27 patch 8.2.3012: when 'rightleft' is set the line number is drawn reversed
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
345
25642
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
346 " This used to cause a divide by zero
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
347 func Test_number_no_text_virtual_edit()
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
348 vnew
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
349 call setline(1, ['line one', 'line two'])
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
350 set number virtualedit=all
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
351 normal w
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
352 4wincmd |
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
353 normal j
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
354 bwipe!
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
355 endfunc
b46214b82d6e patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Bram Moolenaar <Bram@vim.org>
parents: 24950
diff changeset
356
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
357 " vim: shiftwidth=2 sts=2 expandtab