annotate src/testdir/test_cursorline.vim @ 28999:3ac43f48f001

Added tag v8.2.5021 for changeset 983ec746af54b3af022e4707d48f4946888f4d97
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 May 2022 15:15:04 +0200
parents d0241e74bfdb
children f7a2de8a4ddc
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
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 function! s:screen_attr(lnum) abort
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)')
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endfunction
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 function! s:test_windows(h, w) abort
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)
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 endfunction
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 function! s:close_windows() abort
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 call CloseWindow()
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 endfunction
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 function! s:new_hi() abort
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
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 endfunction
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)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
136 call writefile(lines, filename)
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 call delete(filename)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
200 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
201
25334
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
202 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
203 CheckScreendump
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
204 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
205
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
206 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
207 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
208 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
209 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
210 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
211
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
212 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
213 :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
214 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
215 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
216
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
217 *: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
218 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
219 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
220 :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
221 < 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
222 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
223 cindent ~
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
224 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
225 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
226 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
227 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
228 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
229 END
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
230 call writefile(textlines, 'Xtextfile')
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
231
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
232 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
233 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
234 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
235 END
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
236 call writefile(script, 'Xscript')
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
237
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
238 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
239 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
240 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
241 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
242 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
243 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
244
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
245 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
246 call delete('Xscript')
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
247 call delete('Xtextfile')
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
248 endfunc
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
249
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
250 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
251 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
252 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
253
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 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
255 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
256 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
257 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
258
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 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
260 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
261 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
262
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 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
264 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
265 call writefile(lines, 'Xcul_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
266
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 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
268 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
269 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
270
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
271 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
272 call delete('Xcul_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
273 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
274
28209
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
275 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
276 CheckScreendump
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
277
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
278 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
279 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
280 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
281 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
282 END
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
283 call writefile(lines, 'Xcul_screenline')
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
284
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
285 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
286 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
287 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
288 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
289 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
290 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
291
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
292 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
293 call delete('Xcul_screenline')
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
294 endfunc
cbaac8434e4a patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
295
28542
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
296 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
297 CheckScreendump
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
298
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
299 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
300 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
301 \ ' 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
302 set nowrap
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
303 " 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
304 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
305 " 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
306 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
307 20vsp
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
308 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
309 END
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
310 call writefile(lines, 'Xhor_scroll')
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
311
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
312 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
313 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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 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
322 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
323 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
324 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
325 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
326 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
327
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
328 call StopVimInTerminal(buf)
28544
22345596a270 patch 8.2.4796: file left behind after running cursorline tests
Bram Moolenaar <Bram@vim.org>
parents: 28542
diff changeset
329 call delete('Xhor_scroll')
28542
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
330 endfunc
51b5cab35afa patch 8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28209
diff changeset
331
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
332
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
333 " vim: shiftwidth=2 sts=2 expandtab