annotate src/testdir/test_cursorline.vim @ 35145:8b9f22608aa5 default tip

Added tag v9.1.0401 for changeset 2179990b5be67c94e17f829ebd64bcc0cee920ee
author Christian Brabandt <cb@256bit.org>
date Thu, 09 May 2024 20:45:04 +0200
parents f936d46cc9c1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test for cursorline and cursorlineopt
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
2
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 source check.vim
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
4 source screendump.vim
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
6 func s:screen_attr(lnum) abort
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 return map(range(1, 8), 'screenattr(a:lnum, v:val)')
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
8 endfunc
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
10 func s:test_windows(h, w) abort
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 call NewWindow(a:h, a:w)
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
12 endfunc
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
14 func s:close_windows() abort
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 call CloseWindow()
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
16 endfunc
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
18 func s:new_hi() abort
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 redir => save_hi
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 silent! hi CursorLineNr
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 redir END
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 let save_hi = join(split(substitute(save_hi, '\s*xxx\s*', ' ', ''), "\n"), '')
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 exe 'hi' save_hi 'ctermbg=0 guibg=Black'
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 return save_hi
30687
f936d46cc9c1 patch 9.0.0678: using exclamation marks on :function
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
25 endfunc
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 func Test_cursorline_highlight1()
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 let save_hi = s:new_hi()
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 try
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 call s:test_windows(10, 20)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call setline(1, repeat(['aaaa'], 10))
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 let attr01 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 call assert_equal(repeat([attr01[0]], 8), attr01)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 setl number numberwidth=4
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 let attr11 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 call assert_equal(repeat([attr11[0]], 4), attr11[0:3])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call assert_equal(repeat([attr11[4]], 4), attr11[4:7])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 call assert_notequal(attr11[0], attr11[4])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 setl cursorline
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 let attr21 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 let attr22 = s:screen_attr(2)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call assert_equal(repeat([attr21[0]], 4), attr21[0:3])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 call assert_equal(repeat([attr21[4]], 4), attr21[4:7])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 call assert_equal(attr11, attr22)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 call assert_notequal(attr22, attr21)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 setl nocursorline relativenumber
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 let attr31 = s:screen_attr(1)
18245
1f5571e7f012 patch 8.1.2117: CursorLine highlight used while 'cursorline' is off
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
55 call assert_equal(attr22[0:3], attr31[0:3])
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 call assert_equal(attr11[4:7], attr31[4:7])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call s:close_windows()
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 finally
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 exe 'hi' save_hi
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 endtry
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 endfunc
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 func Test_cursorline_highlight2()
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 CheckOption cursorlineopt
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 let save_hi = s:new_hi()
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 try
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 call s:test_windows(10, 20)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 call setline(1, repeat(['aaaa'], 10))
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 let attr0 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 call assert_equal(repeat([attr0[0]], 8), attr0)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 setl number
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 let attr1 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 call assert_notequal(attr0[0:3], attr1[0:3])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 call assert_equal(attr0[0:3], attr1[4:7])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 setl cursorline cursorlineopt=both
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 let attr2 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 call assert_notequal(attr1[0:3], attr2[0:3])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 call assert_notequal(attr1[4:7], attr2[4:7])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 setl cursorlineopt=line
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 let attr3 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 call assert_equal(attr1[0:3], attr3[0:3])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 call assert_equal(attr2[4:7], attr3[4:7])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 setl cursorlineopt=number
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 let attr4 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 call assert_equal(attr2[0:3], attr4[0:3])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 call assert_equal(attr1[4:7], attr4[4:7])
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 setl nonumber
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 redraw
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 let attr5 = s:screen_attr(1)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 call assert_equal(attr0, attr5)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 call s:close_windows()
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 finally
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 exe 'hi' save_hi
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 endtry
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 endfunc
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
109
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
110 func Test_cursorline_screenline()
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
111 CheckScreendump
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
112 CheckOption cursorlineopt
25334
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
113
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
114 let filename='Xcursorline'
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
115 let lines = []
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
116
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
117 let file_content =<< trim END
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
118 1 foooooooo ar eins‍zwei drei vier fünf sechs sieben acht un zehn elf zwöfl dreizehn v ierzehn fünfzehn
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
119 2 foooooooo bar eins zwei drei vier fünf sechs sieben
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
120 3 foooooooo bar eins zwei drei vier fünf sechs sieben
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
121 4 foooooooo bar eins zwei drei vier fünf sechs sieben
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
122 END
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
123 let lines1 =<< trim END1
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
124 set nocp
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
125 set display=lastline
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
126 set cursorlineopt=screenline cursorline nu wrap sbr=>
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
127 hi CursorLineNr ctermfg=blue
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
128 25vsp
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
129 END1
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
130 let lines2 =<< trim END2
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
131 call cursor(1,1)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
132 END2
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
133 call extend(lines, lines1)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
134 call extend(lines, ["call append(0, ".. string(file_content).. ')'])
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
135 call extend(lines, lines2)
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 28809
diff changeset
136 call writefile(lines, filename, 'D')
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
137 " basic test
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
138 let buf = RunVimInTerminal('-S '. filename, #{rows: 20})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
139 call VerifyScreenDump(buf, 'Test_'. filename. '_1', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
140 call term_sendkeys(buf, "fagj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
141 call VerifyScreenDump(buf, 'Test_'. filename. '_2', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
142 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
143 call VerifyScreenDump(buf, 'Test_'. filename. '_3', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
144 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
145 call VerifyScreenDump(buf, 'Test_'. filename. '_4', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
146 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
147 call VerifyScreenDump(buf, 'Test_'. filename. '_5', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
148 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
149 call VerifyScreenDump(buf, 'Test_'. filename. '_6', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
150 " test with set list and cursorlineopt containing number
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
151 call term_sendkeys(buf, "gg0")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
152 call term_sendkeys(buf, ":set list cursorlineopt+=number listchars=space:-\<cr>")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
153 call VerifyScreenDump(buf, 'Test_'. filename. '_7', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
154 call term_sendkeys(buf, "fagj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
155 call VerifyScreenDump(buf, 'Test_'. filename. '_8', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
156 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
157 call VerifyScreenDump(buf, 'Test_'. filename. '_9', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
158 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
159 call VerifyScreenDump(buf, 'Test_'. filename. '_10', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
160 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
161 call VerifyScreenDump(buf, 'Test_'. filename. '_11', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
162 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
163 call VerifyScreenDump(buf, 'Test_'. filename. '_12', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
164 if exists("+foldcolumn") && exists("+signcolumn") && exists("+breakindent")
28171
b4c111ea83b1 patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents: 28133
diff changeset
165 " test with set foldcolumn signcolumn and breakindent
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
166 call term_sendkeys(buf, "gg0")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
167 call term_sendkeys(buf, ":set breakindent foldcolumn=2 signcolumn=yes\<cr>")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
168 call VerifyScreenDump(buf, 'Test_'. filename. '_13', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
169 call term_sendkeys(buf, "fagj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
170 call VerifyScreenDump(buf, 'Test_'. filename. '_14', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
171 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
172 call VerifyScreenDump(buf, 'Test_'. filename. '_15', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
173 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
174 call VerifyScreenDump(buf, 'Test_'. filename. '_16', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
175 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
176 call VerifyScreenDump(buf, 'Test_'. filename. '_17', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
177 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
178 call VerifyScreenDump(buf, 'Test_'. filename. '_18', {})
25517
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
179 call term_sendkeys(buf, ":set breakindent& foldcolumn& signcolumn&\<cr>")
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
180 endif
25517
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
181 " showbreak should not be highlighted with CursorLine when 'number' is off
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
182 call term_sendkeys(buf, "gg0")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
183 call term_sendkeys(buf, ":set list cursorlineopt=screenline listchars=space:-\<cr>")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
184 call term_sendkeys(buf, ":set nonumber\<cr>")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
185 call VerifyScreenDump(buf, 'Test_'. filename. '_19', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
186 call term_sendkeys(buf, "fagj")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
187 call VerifyScreenDump(buf, 'Test_'. filename. '_20', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
188 call term_sendkeys(buf, "gj")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
189 call VerifyScreenDump(buf, 'Test_'. filename. '_21', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
190 call term_sendkeys(buf, "gj")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
191 call VerifyScreenDump(buf, 'Test_'. filename. '_22', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
192 call term_sendkeys(buf, "gj")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
193 call VerifyScreenDump(buf, 'Test_'. filename. '_23', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
194 call term_sendkeys(buf, "gj")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
195 call VerifyScreenDump(buf, 'Test_'. filename. '_24', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
196 call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\<cr>")
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
197
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
198 call StopVimInTerminal(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
199 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
200
25334
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
201 func Test_cursorline_redraw()
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
202 CheckScreendump
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
203 CheckOption cursorlineopt
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
204
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
205 let textlines =<< END
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
206 When the option is a list of flags, {value} must be
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
207 exactly as they appear in the option. Remove flags
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
208 one by one to avoid problems.
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
209 Also see |:set-args| above.
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
210
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
211 The {option} arguments to ":set" may be repeated. For example: >
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
212 :set ai nosi sw=3 ts=3
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
213 If you make an error in one of the arguments, an error message will be given
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
214 and the following arguments will be ignored.
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
215
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
216 *:set-verbose*
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
217 When 'verbose' is non-zero, displaying an option value will also tell where it
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
218 was last set. Example: >
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
219 :verbose set shiftwidth cindent?
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
220 < shiftwidth=4 ~
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
221 Last set from modeline line 1 ~
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
222 cindent ~
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
223 Last set from /usr/local/share/vim/vim60/ftplugin/c.vim line 30 ~
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
224 This is only done when specific option values are requested, not for ":verbose
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
225 set all" or ":verbose set" without an argument.
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
226 When the option was set by hand there is no "Last set" message.
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
227 When the option was set while executing a function, user command or
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
228 END
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 28809
diff changeset
229 call writefile(textlines, 'Xtextfile', 'D')
25334
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
230
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
231 let script =<< trim END
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
232 set cursorline scrolloff=2
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
233 normal 12G
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
234 END
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 28809
diff changeset
235 call writefile(script, 'Xscript', 'D')
25334
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
236
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
237 let buf = RunVimInTerminal('-S Xscript Xtextfile', #{rows: 20, cols: 40})
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
238 call VerifyScreenDump(buf, 'Test_cursorline_redraw_1', {})
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
239 call term_sendkeys(buf, "zt")
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
240 call TermWait(buf)
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
241 call term_sendkeys(buf, "\<C-U>")
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
242 call VerifyScreenDump(buf, 'Test_cursorline_redraw_2', {})
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
243
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
244 call StopVimInTerminal(buf)
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
245 endfunc
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
246
28133
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
247 func Test_cursorline_callback()
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
248 CheckScreendump
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
249 CheckFeature timers
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
250
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
251 let lines =<< trim END
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
252 call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
253 set cursorline
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
254 call cursor(4, 1)
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
255
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
256 func Func(timer)
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
257 call cursor(2, 1)
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
258 endfunc
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
259
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
260 call timer_start(300, 'Func')
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
261 END
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 28809
diff changeset
262 call writefile(lines, 'Xcul_timer', 'D')
28133
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
263
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
264 let buf = RunVimInTerminal('-S Xcul_timer', #{rows: 8})
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
265 call TermWait(buf, 310)
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
266 call VerifyScreenDump(buf, 'Test_cursorline_callback_1', {})
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
267
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
268 call StopVimInTerminal(buf)
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
269 endfunc
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
270
28209
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
271 func Test_cursorline_screenline_update()
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
272 CheckScreendump
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
273
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
274 let lines =<< trim END
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
275 call setline(1, repeat('xyz ', 30))
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
276 set cursorline cursorlineopt=screenline
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
277 inoremap <F2> <Cmd>call cursor(1, 1)<CR>
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
278 END
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 28809
diff changeset
279 call writefile(lines, 'Xcul_screenline', 'D')
28209
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
280
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
281 let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8})
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
282 call term_sendkeys(buf, "A")
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
283 call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {})
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
284 call term_sendkeys(buf, "\<F2>")
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
285 call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {})
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
286 call term_sendkeys(buf, "\<Esc>")
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
287
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
288 call StopVimInTerminal(buf)
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
289 endfunc
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
290
28542
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
291 func Test_cursorline_cursorbind_horizontal_scroll()
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
292 CheckScreendump
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
293
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
294 let lines =<< trim END
28554
6481ccc776f9 patch 8.2.4801: fix for cursorbind fix not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 28544
diff changeset
295 call setline(1, 'aa bb cc dd ee ff gg hh ii jj kk ll mm' ..
28809
d0241e74bfdb patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents: 28554
diff changeset
296 \ ' nn oo pp qq rr ss tt uu vv ww xx yy zz')
28542
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
297 set nowrap
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
298 " The following makes the cursor apparent on the screen dump
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
299 set sidescroll=1 cursorcolumn
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
300 " add empty lines, required for cursorcolumn
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
301 call append(1, ['','','',''])
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
302 20vsp
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
303 windo :set cursorbind
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
304 END
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 28809
diff changeset
305 call writefile(lines, 'Xhor_scroll', 'D')
28542
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
306
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
307 let buf = RunVimInTerminal('-S Xhor_scroll', #{rows: 8})
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
308 call term_sendkeys(buf, "20l")
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
309 call VerifyScreenDump(buf, 'Test_hor_scroll_1', {})
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
310 call term_sendkeys(buf, "10l")
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
311 call VerifyScreenDump(buf, 'Test_hor_scroll_2', {})
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
312 call term_sendkeys(buf, ":windo :set cursorline\<cr>")
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
313 call term_sendkeys(buf, "0")
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
314 call term_sendkeys(buf, "20l")
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
315 call VerifyScreenDump(buf, 'Test_hor_scroll_3', {})
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
316 call term_sendkeys(buf, "10l")
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
317 call VerifyScreenDump(buf, 'Test_hor_scroll_4', {})
28554
6481ccc776f9 patch 8.2.4801: fix for cursorbind fix not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 28544
diff changeset
318 call term_sendkeys(buf, ":windo :set nocursorline nocursorcolumn\<cr>")
6481ccc776f9 patch 8.2.4801: fix for cursorbind fix not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 28544
diff changeset
319 call term_sendkeys(buf, "0")
6481ccc776f9 patch 8.2.4801: fix for cursorbind fix not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 28544
diff changeset
320 call term_sendkeys(buf, "40l")
6481ccc776f9 patch 8.2.4801: fix for cursorbind fix not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 28544
diff changeset
321 call VerifyScreenDump(buf, 'Test_hor_scroll_5', {})
28542
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
322
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
323 call StopVimInTerminal(buf)
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
324 endfunc
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
325
28133
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
326
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
327 " vim: shiftwidth=2 sts=2 expandtab