annotate src/testdir/test_cursorline.vim @ 19783:546bdeef35f1 v8.2.0448

patch 8.2.0448: various functions not properly tested Commit: https://github.com/vim/vim/commit/0e05de46226eb4e5ea580beefa71831f92d613d3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 25 22:23:46 2020 +0100 patch 8.2.0448: various functions not properly tested Problem: Various functions not properly tested. Solution: Add more tests, especially for failures. (Yegappan Lakshmanan, closes #5843)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Mar 2020 22:30:04 +0100
parents 1f5571e7f012
children c087099e9163
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
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
113 let filename='Xcursorline'
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
114 let lines = []
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
115
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
116 let file_content =<< trim END
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
117 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
118 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
119 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
120 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
121 END
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
122 let lines1 =<< trim END1
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
123 set nocp
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
124 set display=lastline
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
125 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
126 hi CursorLineNr ctermfg=blue
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
127 25vsp
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
128 END1
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
129 let lines2 =<< trim END2
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
130 call cursor(1,1)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
131 END2
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
132 call extend(lines, lines1)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
133 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
134 call extend(lines, lines2)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
135 call writefile(lines, filename)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
136 " basic test
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
137 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
138 call term_wait(buf)
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 term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
142 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
143 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
144 call term_wait(buf)
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. '_3', {})
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 term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
148 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
149 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
150 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
151 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
152 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
153 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
154 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
155 " 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
156 call term_sendkeys(buf, "gg0")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
157 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
158 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
159 call term_sendkeys(buf, "fagj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
160 call term_wait(buf)
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. '_8', {})
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 term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
164 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
165 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
166 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
167 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
168 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
169 call term_wait(buf)
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. '_11', {})
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 term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
173 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
174 if exists("+foldcolumn") && exists("+signcolumn") && exists("+breakindent")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
175 " test with set foldcolumn signcoloumn and breakindent
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
176 call term_sendkeys(buf, "gg0")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
177 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
178 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
179 call term_sendkeys(buf, "fagj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
180 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
181 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
182 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
183 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
184 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
185 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
186 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
187 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
188 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
189 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
190 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
191 call term_sendkeys(buf, "gj")
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
192 call term_wait(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
193 call VerifyScreenDump(buf, 'Test_'. filename. '_18', {})
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
194 endif
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
195
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
196 call StopVimInTerminal(buf)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
197 call delete(filename)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
198 endfunc