annotate src/testdir/test_highlight.vim @ 32669:448aef880252

normalize line endings
author Christian Brabandt <cb@256bit.org>
date Mon, 26 Jun 2023 09:54:34 +0200
parents 25f4c1d11344
children 695b50472e85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32669
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1 " Tests for ":highlight" and highlighting.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
3 source view_util.vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
4 source screendump.vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
5 source check.vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
6 source script_util.vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
7 import './vim9.vim' as v9
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
8
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
9 func ClearDict(d)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
10 for k in keys(a:d)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
11 call remove(a:d, k)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
12 endfor
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
13 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
14
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
15 func Test_highlight()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
16 " basic test if ":highlight" doesn't crash
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
17 highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
18 hi Search
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
19
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
20 " test setting colors.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
21 " test clearing one color and all doesn't generate error or warning
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
22 silent! hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
23 silent! hi Group2 term= cterm=
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
24 hi Group3 term=underline cterm=bold
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
25
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
26 let res = split(execute("hi NewGroup"), "\n")[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
27 " filter ctermfg and ctermbg, the numbers depend on the terminal
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
28 let res = substitute(res, 'ctermfg=\d*', 'ctermfg=2', '')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
29 let res = substitute(res, 'ctermbg=\d*', 'ctermbg=3', '')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
30 call assert_equal("NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
31 \ res)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
32 call assert_equal("Group2 xxx cleared",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
33 \ split(execute("hi Group2"), "\n")[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
34 call assert_equal("Group3 xxx term=underline cterm=bold",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
35 \ split(execute("hi Group3"), "\n")[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
36
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
37 hi clear NewGroup
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
38 call assert_equal("NewGroup xxx cleared",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
39 \ split(execute("hi NewGroup"), "\n")[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
40 call assert_equal("Group2 xxx cleared",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
41 \ split(execute("hi Group2"), "\n")[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
42 hi Group2 NONE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
43 call assert_equal("Group2 xxx cleared",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
44 \ split(execute("hi Group2"), "\n")[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
45 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
46 call assert_equal("Group3 xxx cleared",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
47 \ split(execute("hi Group3"), "\n")[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
48 call assert_fails("hi Crash term='asdf", "E475:")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
49
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
50 if has('gui_running')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
51 call assert_fails('hi NotUsed guibg=none', 'E1361:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
52 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
53 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
54
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
55 func HighlightArgs(name)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
56 return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\<xxx\>', '', '')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
57 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
58
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
59 func IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
60 return has('gui_running') || str2nr(&t_Co) >= 8
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
61 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
62
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
63 func HiCursorLine()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
64 let hiCursorLine = HighlightArgs('CursorLine')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
65 if has('gui_running')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
66 let guibg = matchstr(hiCursorLine, 'guibg=\w\+')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
67 let hi_ul = 'hi CursorLine gui=underline guibg=NONE'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
68 let hi_bg = 'hi CursorLine gui=NONE ' . guibg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
69 else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
70 let hi_ul = 'hi CursorLine cterm=underline ctermbg=NONE'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
71 let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
72 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
73 return [hiCursorLine, hi_ul, hi_bg]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
74 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
75
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
76 func Check_lcs_eol_attrs(attrs, row, col)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
77 let save_lcs = &lcs
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
78 set list
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
79
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
80 call assert_equal(a:attrs, ScreenAttrs(a:row, a:col)[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
81
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
82 set nolist
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
83 let &lcs = save_lcs
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
84 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
85
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
86 func Test_highlight_eol_with_cursorline()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
87 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
88
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
89 call NewWindow('topleft 5', 20)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
90 call setline(1, 'abcd')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
91 call matchadd('Search', '\n')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
92
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
93 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
94 " 'abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
95 " ^^^^ ^^^^^ no highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
96 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
97 let attrs0 = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
98 call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
99 call assert_equal(repeat([attrs0[0]], 5), attrs0[5:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
100 call assert_notequal(attrs0[0], attrs0[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
101
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
102 setlocal cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
103
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
104 " underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
105 exe hi_ul
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
106
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
107 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
108 " 'abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
109 " ^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
110 " ^ 'Search' highlight with underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
111 " ^^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
112 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
113 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
114 call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
115 call assert_notequal(attrs[0], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
116 call assert_notequal(attrs[4], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
117 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
118 call assert_notequal(attrs0[4], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
119 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
120
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
121 if IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
122 " bg-color
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
123 exe hi_bg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
124
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
125 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
126 " 'abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
127 " ^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
128 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
129 " ^^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
130 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
131 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
132 call assert_equal(repeat([attrs[5]], 5), attrs[5:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
133 call assert_equal(attrs0[4], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
134 call assert_notequal(attrs[0], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
135 call assert_notequal(attrs[4], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
136 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
137 call assert_notequal(attrs0[5], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
138 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
139 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
140
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
141 call CloseWindow()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
142 exe hiCursorLine
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
143 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
144
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
145 func Test_highlight_eol_with_cursorline_vertsplit()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
146 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
147
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
148 call NewWindow('topleft 5', 5)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
149 call setline(1, 'abcd')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
150 call matchadd('Search', '\n')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
151
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
152 let expected = "abcd |abcd "
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
153 let actual = ScreenLines(1, 15)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
154 call assert_equal(expected, actual)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
155
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
156 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
157 " 'abcd |abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
158 " ^^^^ ^^^^^^^^^ no highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
159 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
160 " ^ 'VertSplit' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
161 let attrs0 = ScreenAttrs(1, 15)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
162 call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
163 call assert_equal(repeat([attrs0[0]], 9), attrs0[6:14])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
164 call assert_notequal(attrs0[0], attrs0[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
165 call assert_notequal(attrs0[0], attrs0[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
166 call assert_notequal(attrs0[4], attrs0[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
167
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
168 setlocal cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
169
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
170 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
171 " 'abcd |abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
172 " ^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
173 " ^ 'Search' highlight with underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
174 " ^ 'VertSplit' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
175 " ^^^^^^^^^ no highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
176
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
177 " underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
178 exe hi_ul
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
179
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
180 let actual = ScreenLines(1, 15)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
181 call assert_equal(expected, actual)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
182
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
183 let attrs = ScreenAttrs(1, 15)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
184 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
185 call assert_equal(repeat([attrs[6]], 9), attrs[6:14])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
186 call assert_equal(attrs0[5:14], attrs[5:14])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
187 call assert_notequal(attrs[0], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
188 call assert_notequal(attrs[0], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
189 call assert_notequal(attrs[0], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
190 call assert_notequal(attrs[4], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
191 call assert_notequal(attrs[5], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
192 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
193 call assert_notequal(attrs0[4], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
194 call Check_lcs_eol_attrs(attrs, 1, 15)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
195
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
196 if IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
197 " bg-color
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
198 exe hi_bg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
199
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
200 let actual = ScreenLines(1, 15)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
201 call assert_equal(expected, actual)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
202
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
203 let attrs = ScreenAttrs(1, 15)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
204 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
205 call assert_equal(repeat([attrs[6]], 9), attrs[6:14])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
206 call assert_equal(attrs0[5:14], attrs[5:14])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
207 call assert_notequal(attrs[0], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
208 call assert_notequal(attrs[0], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
209 call assert_notequal(attrs[0], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
210 call assert_notequal(attrs[4], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
211 call assert_notequal(attrs[5], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
212 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
213 call assert_equal(attrs0[4], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
214 call Check_lcs_eol_attrs(attrs, 1, 15)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
215 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
216
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
217 call CloseWindow()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
218 exe hiCursorLine
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
219 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
220
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
221 func Test_highlight_eol_with_cursorline_rightleft()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
222 CheckFeature rightleft
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
223
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
224 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
225
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
226 call NewWindow('topleft 5', 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
227 setlocal rightleft
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
228 call setline(1, 'abcd')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
229 call matchadd('Search', '\n')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
230 let attrs0 = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
231
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
232 setlocal cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
233
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
234 " underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
235 exe hi_ul
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
236
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
237 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
238 " ' dcba'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
239 " ^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
240 " ^ 'Search' highlight with underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
241 " ^^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
242 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
243 call assert_equal(repeat([attrs[9]], 4), attrs[6:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
244 call assert_equal(repeat([attrs[4]], 5) + [attrs[5]], attrs[0:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
245 call assert_notequal(attrs[9], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
246 call assert_notequal(attrs[4], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
247 call assert_notequal(attrs0[9], attrs[9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
248 call assert_notequal(attrs0[5], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
249 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
250
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
251 if IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
252 " bg-color
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
253 exe hi_bg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
254
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
255 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
256 " ' dcba'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
257 " ^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
258 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
259 " ^^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
260 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
261 call assert_equal(repeat([attrs[9]], 4), attrs[6:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
262 call assert_equal(repeat([attrs[4]], 5), attrs[0:4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
263 call assert_equal(attrs0[5], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
264 call assert_notequal(attrs[9], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
265 call assert_notequal(attrs[5], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
266 call assert_notequal(attrs0[9], attrs[9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
267 call assert_notequal(attrs0[4], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
268 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
269 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
270
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
271 call CloseWindow()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
272 exe hiCursorLine
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
273 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
274
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
275 func Test_highlight_eol_with_cursorline_linewrap()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
276 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
277
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
278 call NewWindow('topleft 5', 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
279 call setline(1, [repeat('a', 51) . 'bcd', ''])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
280 call matchadd('Search', '\n')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
281
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
282 setlocal wrap
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
283 normal! gg$
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
284 let attrs0 = ScreenAttrs(5, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
285 setlocal cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
286
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
287 " underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
288 exe hi_ul
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
289
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
290 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
291 " 'abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
292 " ^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
293 " ^ 'Search' highlight with underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
294 " ^^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
295 let attrs = ScreenAttrs(5, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
296 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
297 call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
298 call assert_notequal(attrs[0], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
299 call assert_notequal(attrs[4], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
300 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
301 call assert_notequal(attrs0[4], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
302 call Check_lcs_eol_attrs(attrs, 5, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
303
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
304 if IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
305 " bg-color
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
306 exe hi_bg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
307
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
308 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
309 " 'abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
310 " ^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
311 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
312 " ^^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
313 let attrs = ScreenAttrs(5, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
314 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
315 call assert_equal(repeat([attrs[5]], 5), attrs[5:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
316 call assert_equal(attrs0[4], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
317 call assert_notequal(attrs[0], attrs[4])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
318 call assert_notequal(attrs[4], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
319 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
320 call assert_notequal(attrs0[5], attrs[5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
321 call Check_lcs_eol_attrs(attrs, 5, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
322 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
323
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
324 setlocal nocursorline nowrap
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
325 normal! gg$
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
326 let attrs0 = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
327 setlocal cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
328
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
329 " underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
330 exe hi_ul
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
331
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
332 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
333 " 'aaabcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
334 " ^^^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
335 " ^ 'Search' highlight with underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
336 " ^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
337 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
338 call assert_equal(repeat([attrs[0]], 6), attrs[0:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
339 call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
340 call assert_notequal(attrs[0], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
341 call assert_notequal(attrs[6], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
342 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
343 call assert_notequal(attrs0[6], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
344 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
345
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
346 if IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
347 " bg-color
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
348 exe hi_bg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
349
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
350 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
351 " 'aaabcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
352 " ^^^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
353 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
354 " ^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
355 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
356 call assert_equal(repeat([attrs[0]], 6), attrs[0:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
357 call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
358 call assert_equal(attrs0[6], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
359 call assert_notequal(attrs[0], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
360 call assert_notequal(attrs[6], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
361 call assert_notequal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
362 call assert_notequal(attrs0[7], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
363 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
364 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
365
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
366 call CloseWindow()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
367 exe hiCursorLine
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
368 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
369
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
370 func Test_highlight_eol_with_cursorline_sign()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
371 CheckFeature signs
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
372
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
373 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
374
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
375 call NewWindow('topleft 5', 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
376 call setline(1, 'abcd')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
377 call matchadd('Search', '\n')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
378
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
379 sign define Sign text=>>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
380 exe 'sign place 1 line=1 name=Sign buffer=' . bufnr('')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
381 let attrs0 = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
382 setlocal cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
383
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
384 " underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
385 exe hi_ul
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
386
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
387 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
388 " '>>abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
389 " ^^ sign
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
390 " ^^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
391 " ^ 'Search' highlight with underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
392 " ^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
393 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
394 call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
395 call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
396 call assert_notequal(attrs[2], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
397 call assert_notequal(attrs[6], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
398 call assert_notequal(attrs0[2], attrs[2])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
399 call assert_notequal(attrs0[6], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
400 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
401
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
402 if IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
403 " bg-color
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
404 exe hi_bg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
405
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
406 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
407 " '>>abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
408 " ^^ sign
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
409 " ^^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
410 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
411 " ^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
412 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
413 call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
414 call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
415 call assert_equal(attrs0[6], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
416 call assert_notequal(attrs[2], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
417 call assert_notequal(attrs[6], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
418 call assert_notequal(attrs0[2], attrs[2])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
419 call assert_notequal(attrs0[7], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
420 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
421 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
422
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
423 sign unplace 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
424 call CloseWindow()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
425 exe hiCursorLine
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
426 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
427
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
428 func Test_highlight_eol_with_cursorline_breakindent()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
429 CheckFeature linebreak
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
430
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
431 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
432
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
433 call NewWindow('topleft 5', 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
434 set showbreak=xxx
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
435 setlocal breakindent breakindentopt=min:0,shift:1 showbreak=>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
436 call setline(1, ' ' . repeat('a', 9) . 'bcd')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
437 call matchadd('Search', '\n')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
438 let attrs0 = ScreenAttrs(2, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
439 setlocal cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
440
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
441 " underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
442 exe hi_ul
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
443
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
444 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
445 " ' >bcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
446 " ^^^ breakindent and showbreak
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
447 " ^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
448 " ^ 'Search' highlight with underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
449 " ^^^ underline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
450 let attrs = ScreenAttrs(2, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
451 call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
452 call assert_equal(repeat([attrs[3]], 3), attrs[3:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
453 call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
454 call assert_equal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
455 call assert_notequal(attrs[0], attrs[2])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
456 call assert_notequal(attrs[2], attrs[3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
457 call assert_notequal(attrs[3], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
458 call assert_notequal(attrs[6], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
459 call assert_notequal(attrs0[2], attrs[2])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
460 call assert_notequal(attrs0[3], attrs[3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
461 call assert_notequal(attrs0[6], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
462 call Check_lcs_eol_attrs(attrs, 2, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
463
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
464 if IsColorable()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
465 " bg-color
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
466 exe hi_bg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
467
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
468 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
469 " ' >bcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
470 " ^^^ breakindent and showbreak
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
471 " ^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
472 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
473 " ^^^ bg-color of 'CursorLine'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
474 let attrs = ScreenAttrs(2, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
475 call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
476 call assert_equal(repeat([attrs[3]], 3), attrs[3:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
477 call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
478 call assert_equal(attrs0[0], attrs[0])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
479 call assert_equal(attrs0[6], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
480 call assert_notequal(attrs[0], attrs[2])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
481 call assert_notequal(attrs[2], attrs[3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
482 call assert_notequal(attrs[3], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
483 call assert_notequal(attrs[6], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
484 call assert_notequal(attrs0[2], attrs[2])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
485 call assert_notequal(attrs0[3], attrs[3])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
486 call assert_notequal(attrs0[7], attrs[7])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
487 call Check_lcs_eol_attrs(attrs, 2, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
488 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
489
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
490 call CloseWindow()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
491 set showbreak=
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
492 setlocal showbreak=
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
493 exe hiCursorLine
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
494 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
495
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
496 func Test_highlight_eol_on_diff()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
497 call setline(1, ['abcd', ''])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
498 call matchadd('Search', '\n')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
499 let attrs0 = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
500
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
501 diffthis
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
502 botright new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
503 diffthis
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
504
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
505 " expected:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
506 " ' abcd '
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
507 " ^^ sign
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
508 " ^^^^ ^^^ 'DiffAdd' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
509 " ^ 'Search' highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
510 let attrs = ScreenAttrs(1, 10)[0]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
511 call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
512 call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
513 call assert_equal(repeat([attrs[2]], 3), attrs[7:9])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
514 call assert_equal(attrs0[4], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
515 call assert_notequal(attrs[0], attrs[2])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
516 call assert_notequal(attrs[0], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
517 call assert_notequal(attrs[2], attrs[6])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
518 call Check_lcs_eol_attrs(attrs, 1, 10)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
519
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
520 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
521 diffoff
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
522 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
523
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
524 func Test_termguicolors()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
525 CheckOption termguicolors
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
526 if has('vtp') && !has('vcon') && !has('gui_running')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
527 " Win32: 'guicolors' doesn't work without virtual console.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
528 call assert_fails('set termguicolors', 'E954:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
529 return
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
530 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
531
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
532 " Basic test that setting 'termguicolors' works with one color.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
533 set termguicolors
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
534 redraw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
535 set t_Co=1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
536 redraw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
537 set t_Co=0
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
538 redraw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
539 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
540
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
541 func Test_cursorline_after_yank()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
542 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
543
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
544 call writefile([
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
545 \ 'set cul rnu',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
546 \ 'call setline(1, ["","1","2","3",""])',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
547 \ ], 'Xtest_cursorline_yank', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
548 let buf = RunVimInTerminal('-S Xtest_cursorline_yank', {'rows': 8})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
549 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
550 call term_sendkeys(buf, "Gy3k")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
551 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
552 call term_sendkeys(buf, "jj")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
553
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
554 call VerifyScreenDump(buf, 'Test_cursorline_yank_01', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
555
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
556 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
557 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
558 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
559
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
560 " test for issue #4862
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
561 func Test_put_before_cursorline()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
562 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
563 only!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
564 call setline(1, 'A')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
565 redraw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
566 let std_attr = screenattr(1, 1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
567 set cursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
568 redraw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
569 let cul_attr = screenattr(1, 1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
570 normal yyP
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
571 redraw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
572 " Line 1 has cursor so it should be highlighted with CursorLine.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
573 call assert_equal(cul_attr, screenattr(1, 1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
574 " And CursorLine highlighting from the second line should be gone.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
575 call assert_equal(std_attr, screenattr(2, 1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
576 set nocursorline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
577 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
578 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
579
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
580 func Test_cursorline_with_visualmode()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
581 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
582
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
583 call writefile([
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
584 \ 'set cul',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
585 \ 'call setline(1, repeat(["abc"], 50))',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
586 \ ], 'Xtest_cursorline_with_visualmode', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
587 let buf = RunVimInTerminal('-S Xtest_cursorline_with_visualmode', {'rows': 12})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
588 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
589 call term_sendkeys(buf, "V\<C-f>kkkjk")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
590
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
591 call VerifyScreenDump(buf, 'Test_cursorline_with_visualmode_01', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
592
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
593 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
594 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
595 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
596
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
597 func Test_cursorcolumn_insert_on_tab()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
598 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
599
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
600 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
601 call setline(1, ['123456789', "a\tb"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
602 set cursorcolumn
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
603 call cursor(2, 2)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
604 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
605 call writefile(lines, 'Xcuc_insert_on_tab', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
606
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
607 let buf = RunVimInTerminal('-S Xcuc_insert_on_tab', #{rows: 8})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
608 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
609 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_1', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
610
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
611 call term_sendkeys(buf, 'i')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
612 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
613 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
614
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
615 call term_sendkeys(buf, "\<C-O>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
616 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
617 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_3', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
618
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
619 call term_sendkeys(buf, 'i')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
620 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
621 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
622
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
623 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
624 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
625
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
626 func Test_cursorcolumn_callback()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
627 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
628 CheckFeature timers
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
629
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
630 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
631 call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
632 set cursorcolumn
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
633 call cursor(4, 5)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
634
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
635 func Func(timer)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
636 call cursor(1, 1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
637 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
638
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
639 call timer_start(300, 'Func')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
640 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
641 call writefile(lines, 'Xcuc_timer', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
642
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
643 let buf = RunVimInTerminal('-S Xcuc_timer', #{rows: 8})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
644 call TermWait(buf, 310)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
645 call VerifyScreenDump(buf, 'Test_cursorcolumn_callback_1', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
646
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
647 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
648 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
649
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
650 func Test_wincolor()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
651 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
652 " make sure the width is enough for the test
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
653 set columns=80
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
654
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
655 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
656 set cursorline cursorcolumn rnu
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
657 call setline(1, ["","1111111111","22222222222","3 here 3","","the cat is out of the bag"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
658 set wincolor=Pmenu
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
659 hi CatLine guifg=green ctermfg=green
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
660 hi Reverse gui=reverse cterm=reverse
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
661 syn match CatLine /^the.*/
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
662 call prop_type_add("foo", {"highlight": "Reverse", "combine": 1})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
663 call prop_add(6, 12, {"type": "foo", "end_col": 15})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
664 /here
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
665 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
666 call writefile(lines, 'Xtest_wincolor', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
667 let buf = RunVimInTerminal('-S Xtest_wincolor', {'rows': 8})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
668 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
669 call term_sendkeys(buf, "2G5lvj")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
670 call TermWait(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
671
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
672 call VerifyScreenDump(buf, 'Test_wincolor_01', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
673
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
674 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
675 call term_sendkeys(buf, "\<Esc>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
676 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
677 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
678
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
679 func Test_wincolor_listchars()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
680 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
681 CheckFeature conceal
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
682
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
683 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
684 call setline(1, ["one","\t\tsome random text enough long to show 'extends' and 'precedes' includingnbsps, preceding tabs and trailing spaces ","three"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
685 set wincolor=Todo
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
686 set nowrap cole=1 cocu+=n
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
687 set list lcs=eol:$,tab:>-,space:.,trail:_,extends:>,precedes:<,conceal:*,nbsp:#
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
688 call matchadd('Conceal', 'text')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
689 normal 2G5zl
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
690 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
691 call writefile(lines, 'Xtest_wincolorlcs', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
692 let buf = RunVimInTerminal('-S Xtest_wincolorlcs', {'rows': 8})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
693
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
694 call VerifyScreenDump(buf, 'Test_wincolor_lcs', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
695
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
696 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
697 call term_sendkeys(buf, "\<Esc>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
698 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
699 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
700
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
701 func Test_colorcolumn()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
702 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
703
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
704 " check that setting 'colorcolumn' when entering a buffer works
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
705 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
706 split
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
707 edit X
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
708 call setline(1, ["1111111111","22222222222","3333333333"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
709 set nomodified
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
710 set colorcolumn=3,9
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
711 set number cursorline cursorlineopt=number
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
712 wincmd w
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
713 buf X
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
714 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
715 call writefile(lines, 'Xtest_colorcolumn', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
716 let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
717 call term_sendkeys(buf, ":\<CR>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
718 call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
719
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
720 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
721 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
722 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
723
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
724 func Test_colorcolumn_bri()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
725 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
726
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
727 " check 'colorcolumn' when 'breakindent' is set
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
728 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
729 call setline(1, 'The quick brown fox jumped over the lazy dogs')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
730 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
731 call writefile(lines, 'Xtest_colorcolumn_bri', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
732 let buf = RunVimInTerminal('-S Xtest_colorcolumn_bri', {'rows': 10,'columns': 40})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
733 call term_sendkeys(buf, ":set co=40 linebreak bri briopt=shift:2 cc=40,41,43\<CR>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
734 call VerifyScreenDump(buf, 'Test_colorcolumn_2', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
735
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
736 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
737 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
738 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
739
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
740 func Test_colorcolumn_sbr()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
741 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
742
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
743 " check 'colorcolumn' when 'showbreak' is set
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
744 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
745 call setline(1, 'The quick brown fox jumped over the lazy dogs')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
746 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
747 call writefile(lines, 'Xtest_colorcolumn_srb', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
748 let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
749 call term_sendkeys(buf, ":set co=40 showbreak=+++>\\ cc=40,41,43\<CR>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
750 call VerifyScreenDump(buf, 'Test_colorcolumn_3', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
751
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
752 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
753 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
754 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
755
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
756 func Test_visual_sbr()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
757 CheckScreendump
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
758
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
759 " check Visual highlight when 'showbreak' is set
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
760 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
761 set showbreak=>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
762 call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
763 exe "normal! z1\<CR>"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
764 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
765 call writefile(lines, 'Xtest_visual_sbr', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
766 let buf = RunVimInTerminal('-S Xtest_visual_sbr', {'rows': 6,'columns': 60})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
767
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
768 call term_sendkeys(buf, "v$")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
769 call VerifyScreenDump(buf, 'Test_visual_sbr_1', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
770
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
771 " clean up
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
772 call term_sendkeys(buf, "\<Esc>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
773 call StopVimInTerminal(buf)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
774 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
775
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
776 " This test must come before the Test_cursorline test, as it appears this
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
777 " defines the Normal highlighting group anyway.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
778 func Test_1_highlight_Normalgroup_exists()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
779 let hlNormal = HighlightArgs('Normal')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
780 if !has('gui_running')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
781 call assert_match('hi Normal\s*clear', hlNormal)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
782 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
783 " expect is DEFAULT_FONT of gui_gtk_x11.c
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
784 call assert_match('hi Normal\s*font=Monospace 10', hlNormal)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
785 elseif has('gui_motif')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
786 " expect is DEFAULT_FONT of gui_x11.c
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
787 call assert_match('hi Normal\s*font=7x13', hlNormal)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
788 elseif has('win32')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
789 " expect any font
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
790 call assert_match('hi Normal\s*font=.*', hlNormal)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
791 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
792 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
793
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
794 " Do this test last, sometimes restoring the columns doesn't work
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
795 func Test_z_no_space_before_xxx()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
796 let l:org_columns = &columns
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
797 set columns=17
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
798 let l:hi_StatusLineTermNC = join(split(execute('hi StatusLineTermNC')))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
799 call assert_match('StatusLineTermNC xxx', l:hi_StatusLineTermNC)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
800 let &columns = l:org_columns
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
801 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
802
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
803 " Test for :highlight command errors
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
804 func Test_highlight_cmd_errors()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
805 if has('gui_running')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
806 " This test doesn't fail in the MS-Windows console version.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
807 call assert_fails('hi Xcomment ctermbg=fg', 'E419:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
808 call assert_fails('hi Xcomment ctermfg=bg', 'E420:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
809 call assert_fails('hi Xcomment ctermfg=ul', 'E453:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
810 call assert_fails('hi ' .. repeat('a', 201) .. ' ctermfg=black', 'E1249:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
811 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
812
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
813 " Try using a very long terminal code. Define a dummy terminal code for this
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
814 " test.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
815 let &t_fo = "\<Esc>1;"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
816 let c = repeat("t_fo,", 100) . "t_fo"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
817 call assert_fails('exe "hi Xgroup1 start=" . c', 'E422:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
818 let &t_fo = ""
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
819 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
820
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
821 " Test for 'highlight' option
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
822 func Test_highlight_opt()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
823 let save_hl = &highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
824 call assert_fails('set highlight=j:b', 'E474:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
825 set highlight=f\ r
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
826 call assert_equal('f r', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
827 set highlight=fb
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
828 call assert_equal('fb', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
829 set highlight=fi
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
830 call assert_equal('fi', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
831 set highlight=f-
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
832 call assert_equal('f-', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
833 set highlight=fr
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
834 call assert_equal('fr', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
835 set highlight=fs
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
836 call assert_equal('fs', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
837 set highlight=fu
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
838 call assert_equal('fu', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
839 set highlight=fc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
840 call assert_equal('fc', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
841 set highlight=ft
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
842 call assert_equal('ft', &highlight)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
843 call assert_fails('set highlight=fr:Search', 'E474:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
844 set highlight=f:$#
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
845 call assert_match('W18:', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
846 let &highlight = save_hl
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
847 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
848
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
849 " Test for User group highlighting used in the statusline
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
850 func Test_highlight_User()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
851 CheckNotGui
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
852 hi User1 ctermfg=12
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
853 redraw!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
854 call assert_equal('12', synIDattr(synIDtrans(hlID('User1')), 'fg'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
855 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
856 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
857
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
858 " Test for using RGB color values in a highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
859 func Test_xxlast_highlight_RGB_color()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
860 CheckCanRunGui
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
861 gui -f
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
862 hi MySearch guifg=#110000 guibg=#001100 guisp=#000011
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
863 call assert_equal('#110000', synIDattr(synIDtrans(hlID('MySearch')), 'fg#'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
864 call assert_equal('#001100', synIDattr(synIDtrans(hlID('MySearch')), 'bg#'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
865 call assert_equal('#000011', synIDattr(synIDtrans(hlID('MySearch')), 'sp#'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
866 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
867 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
868
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
869 " Test for using default highlighting group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
870 func Test_highlight_default()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
871 highlight MySearch ctermfg=7
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
872 highlight default MySearch ctermfg=5
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
873 let hlSearch = HighlightArgs('MySearch')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
874 call assert_match('ctermfg=7', hlSearch)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
875
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
876 highlight default QFName ctermfg=3
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
877 call assert_match('ctermfg=3', HighlightArgs('QFName'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
878 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
879 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
880
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
881 " Test for 'ctermul in a highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
882 func Test_highlight_ctermul()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
883 CheckNotGui
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
884 call assert_notmatch('ctermul=', HighlightArgs('Normal'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
885 highlight Normal ctermul=3
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
886 call assert_match('ctermul=3', HighlightArgs('Normal'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
887 call assert_equal('3', synIDattr(synIDtrans(hlID('Normal')), 'ul'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
888 highlight Normal ctermul=NONE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
889 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
890
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
891 " Test for specifying 'start' and 'stop' in a highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
892 func Test_highlight_start_stop()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
893 hi HlGrp1 start=<Esc>[27h;<Esc>[<Space>r;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
894 call assert_match("start=^[[27h;^[[ r;", HighlightArgs('HlGrp1'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
895 hi HlGrp1 start=NONE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
896 call assert_notmatch("start=", HighlightArgs('HlGrp1'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
897 hi HlGrp2 stop=<Esc>[27h;<Esc>[<Space>r;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
898 call assert_match("stop=^[[27h;^[[ r;", HighlightArgs('HlGrp2'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
899 hi HlGrp2 stop=NONE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
900 call assert_notmatch("stop=", HighlightArgs('HlGrp2'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
901 set t_xy=^[foo;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
902 set t_xz=^[bar;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
903 hi HlGrp3 start=t_xy stop=t_xz
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
904 let d = hlget('HlGrp3')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
905 call assert_equal('^[foo;', d[0].start)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
906 call assert_equal('^[bar;', d[0].stop)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
907 set t_xy= t_xz=
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
908 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
909 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
910
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
911 " Test for setting various 'term' attributes
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
912 func Test_highlight_term_attr()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
913 hi HlGrp3 term=bold,underline,undercurl,underdouble,underdotted,underdashed,strikethrough,reverse,italic,standout
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
914 call assert_equal('hi HlGrp3 term=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough', HighlightArgs('HlGrp3'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
915 hi HlGrp3 term=NONE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
916 call assert_equal('hi HlGrp3 cleared', HighlightArgs('HlGrp3'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
917 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
918 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
919
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
920 func Test_highlight_clear_restores_links()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
921 let aaa_id = hlID('aaa')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
922 call assert_equal(aaa_id, 0)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
923
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
924 " create default link aaa --> bbb
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
925 hi def link aaa bbb
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
926 let id_aaa = hlID('aaa')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
927 let hl_aaa_bbb = HighlightArgs('aaa')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
928
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
929 " try to redefine default link aaa --> ccc; check aaa --> bbb
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
930 hi def link aaa ccc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
931 call assert_equal(HighlightArgs('aaa'), hl_aaa_bbb)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
932
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
933 " clear aaa; check aaa --> bbb
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
934 hi clear aaa
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
935 call assert_equal(HighlightArgs('aaa'), hl_aaa_bbb)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
936
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
937 " link aaa --> ccc; clear aaa; check aaa --> bbb
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
938 hi link aaa ccc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
939 let id_ccc = hlID('ccc')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
940 call assert_equal(synIDtrans(id_aaa), id_ccc)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
941 hi clear aaa
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
942 call assert_equal(HighlightArgs('aaa'), hl_aaa_bbb)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
943
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
944 " forcibly set default link aaa --> ddd
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
945 hi! def link aaa ddd
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
946 let id_ddd = hlID('ddd')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
947 let hl_aaa_ddd = HighlightArgs('aaa')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
948 call assert_equal(synIDtrans(id_aaa), id_ddd)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
949
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
950 " link aaa --> eee; clear aaa; check aaa --> ddd
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
951 hi link aaa eee
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
952 let eee_id = hlID('eee')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
953 call assert_equal(synIDtrans(id_aaa), eee_id)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
954 hi clear aaa
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
955 call assert_equal(HighlightArgs('aaa'), hl_aaa_ddd)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
956 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
957
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
958 func Test_highlight_clear_restores_context()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
959 func FuncContextDefault()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
960 hi def link Context ContextDefault
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
961 endfun
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
962
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
963 func FuncContextRelink()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
964 " Dummy line
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
965 hi link Context ContextRelink
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
966 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
967
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
968 let scriptContextDefault = MakeScript("FuncContextDefault")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
969 let scriptContextRelink = MakeScript("FuncContextRelink")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
970 let patContextDefault = fnamemodify(scriptContextDefault, ':t') .. ' line 1'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
971 let patContextRelink = fnamemodify(scriptContextRelink, ':t') .. ' line 2'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
972
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
973 exec 'source ' .. scriptContextDefault
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
974 let hlContextDefault = execute("verbose hi Context")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
975 call assert_match(patContextDefault, hlContextDefault)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
976
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
977 exec 'source ' .. scriptContextRelink
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
978 let hlContextRelink = execute("verbose hi Context")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
979 call assert_match(patContextRelink, hlContextRelink)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
980
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
981 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
982 let hlContextAfterClear = execute("verbose hi Context")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
983 call assert_match(patContextDefault, hlContextAfterClear)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
984
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
985 delfunc FuncContextDefault
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
986 delfunc FuncContextRelink
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
987 call delete(scriptContextDefault)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
988 call delete(scriptContextRelink)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
989 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
990
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
991 func Test_highlight_default_colorscheme_restores_links()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
992 hi link TestLink Identifier
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
993 hi TestHi ctermbg=red
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
994
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
995 let hlTestLinkPre = HighlightArgs('TestLink')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
996 let hlTestHiPre = HighlightArgs('TestHi')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
997
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
998 " Test colorscheme
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
999 call assert_equal("\ndefault", execute('colorscheme'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1000 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1001 if exists('syntax_on')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1002 syntax reset
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1003 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1004 let g:colors_name = 'test'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1005 call assert_equal("\ntest", execute('colorscheme'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1006 hi link TestLink ErrorMsg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1007 hi TestHi ctermbg=green
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1008
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1009 " Restore default highlighting
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1010 colorscheme default
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1011 " 'default' should work no matter if highlight group was cleared
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1012 call assert_equal("\ndefault", execute('colorscheme'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1013 hi def link TestLink Identifier
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1014 hi def TestHi ctermbg=red
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1015 let hlTestLinkPost = HighlightArgs('TestLink')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1016 let hlTestHiPost = HighlightArgs('TestHi')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1017 call assert_equal(hlTestLinkPre, hlTestLinkPost)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1018 call assert_equal(hlTestHiPre, hlTestHiPost)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1019 hi clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1020 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1021
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1022 func Test_colornames_assignment_and_lookup()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1023 CheckAnyOf Feature:gui_running Feature:termguicolors
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1024
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1025 " Ensure highlight command can find custom color.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1026 let v:colornames['a redish white'] = '#ffeedd'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1027 highlight Normal guifg='a redish white'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1028 highlight clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1029 call ClearDict(v:colornames)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1030 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1031
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1032 func Test_colornames_default_list()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1033 CheckAnyOf Feature:gui_running Feature:termguicolors
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1034
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1035 " Ensure default lists are loaded automatically and can be used for all gui fields.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1036 call assert_equal(0, len(v:colornames))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1037 highlight Normal guifg='rebecca purple' guibg='rebecca purple' guisp='rebecca purple'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1038 call assert_notequal(0, len(v:colornames))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1039 echo v:colornames['rebecca purple']
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1040 highlight clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1041 call ClearDict(v:colornames)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1042 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1043
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1044 func Test_colornames_overwrite_default()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1045 CheckAnyOf Feature:gui_running Feature:termguicolors
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1046
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1047 " Ensure entries in v:colornames can be overwritten.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1048 " Load default color scheme to trigger default color list loading.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1049 colorscheme default
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1050 let old_rebecca_purple = v:colornames['rebecca purple']
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1051 highlight Normal guifg='rebecca purple' guibg='rebecca purple'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1052 let v:colornames['rebecca purple'] = '#550099'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1053 highlight Normal guifg='rebecca purple' guibg='rebecca purple'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1054 let v:colornames['rebecca purple'] = old_rebecca_purple
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1055 highlight clear
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1056 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1057
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1058 func Test_colornames_assignment_and_unassignment()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1059 " No feature check is needed for this test because the v:colornames dict
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1060 " always exists with +eval. The feature checks are only required for
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1061 " commands that do color lookup.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1062
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1063 " Ensure we cannot overwrite the v:colornames dict.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1064 call assert_fails("let v:colornames = {}", 'E46:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1065
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1066 " Ensure we can delete entries from the v:colornames dict.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1067 let v:colornames['x1'] = '#111111'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1068 call assert_equal(v:colornames['x1'], '#111111')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1069 unlet v:colornames['x1']
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1070 call assert_fails("echo v:colornames['x1']")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1071 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1072
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1073 " Test for the hlget() function
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1074 func Test_hlget()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1075 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1076 call assert_notequal([], filter(hlget(), 'v:val.name == "Visual"'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1077 call assert_equal([], hlget('SomeHLGroup'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1078 highlight MyHLGroup term=standout cterm=reverse ctermfg=10 ctermbg=Black
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1079 call assert_equal([{'id': hlID('MyHLGroup'), 'ctermfg': '10', 'name': 'MyHLGroup', 'term': {'standout': v:true}, 'ctermbg': '0', 'cterm': {'reverse': v:true}}], hlget('MyHLGroup'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1080 highlight clear MyHLGroup
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1081 call assert_equal(v:true, hlget('MyHLGroup')[0].cleared)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1082 highlight link MyHLGroup IncSearch
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1083 call assert_equal('IncSearch', hlget('MyHLGroup')[0].linksto)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1084 highlight clear MyHLGroup
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1085 call assert_equal([], hlget(test_null_string()))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1086 call assert_equal([], hlget(""))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1087 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1088 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1089
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1090 " Test for resolving highlight group links
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1091 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1092 highlight hlgA term=bold
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1093 VAR hlgAid = hlID('hlgA')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1094 highlight link hlgB hlgA
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1095 VAR hlgBid = hlID('hlgB')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1096 highlight link hlgC hlgB
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1097 VAR hlgCid = hlID('hlgC')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1098 call assert_equal('hlgA', hlget('hlgB')[0].linksto)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1099 call assert_equal('hlgB', hlget('hlgC')[0].linksto)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1100 call assert_equal([{'id': hlgAid, 'name': 'hlgA',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1101 \ 'term': {'bold': v:true}}], hlget('hlgA'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1102 call assert_equal([{'id': hlgBid, 'name': 'hlgB',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1103 \ 'linksto': 'hlgA'}], hlget('hlgB'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1104 call assert_equal([{'id': hlgCid, 'name': 'hlgC',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1105 \ 'linksto': 'hlgB'}], hlget('hlgC'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1106 call assert_equal([{'id': hlgAid, 'name': 'hlgA',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1107 \ 'term': {'bold': v:true}}], hlget('hlgA', v:false))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1108 call assert_equal([{'id': hlgBid, 'name': 'hlgB',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1109 \ 'linksto': 'hlgA'}], hlget('hlgB', 0))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1110 call assert_equal([{'id': hlgCid, 'name': 'hlgC',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1111 \ 'linksto': 'hlgB'}], hlget('hlgC', v:false))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1112 call assert_equal([{'id': hlgAid, 'name': 'hlgA',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1113 \ 'term': {'bold': v:true}}], hlget('hlgA', v:true))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1114 call assert_equal([{'id': hlgBid, 'name': 'hlgB',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1115 \ 'term': {'bold': v:true}}], hlget('hlgB', 1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1116 call assert_equal([{'id': hlgCid, 'name': 'hlgC',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1117 \ 'term': {'bold': v:true}}], hlget('hlgC', v:true))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1118 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1119 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1120
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1121 call assert_fails('call hlget([])', 'E1174:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1122 call assert_fails('call hlget("abc", "xyz")', 'E1212:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1123 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1124
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1125 " Test for the hlset() function
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1126 func Test_hlset()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1127 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1128 call assert_equal(0, hlset(test_null_list()))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1129 call assert_equal(0, hlset([]))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1130 call assert_fails('call hlset(["Search"])', 'E715:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1131 call hlset(hlget())
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1132 call hlset([{'name': 'NewHLGroup', 'cterm': {'reverse': v:true}, 'ctermfg': '10'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1133 call assert_equal({'reverse': v:true}, hlget('NewHLGroup')[0].cterm)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1134 call hlset([{'name': 'NewHLGroup', 'cterm': {'bold': v:true}}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1135 call assert_equal({'bold': v:true}, hlget('NewHLGroup')[0].cterm)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1136 call hlset([{'name': 'NewHLGroup', 'cleared': v:true}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1137 call assert_equal(v:true, hlget('NewHLGroup')[0].cleared)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1138 call hlset([{'name': 'NewHLGroup', 'linksto': 'Search'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1139 call assert_false(has_key(hlget('NewHLGroup')[0], 'cleared'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1140 call assert_equal('Search', hlget('NewHLGroup')[0].linksto)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1141 call assert_fails("call hlset([{'name': [], 'ctermfg': '10'}])", 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1142 call assert_fails("call hlset([{'name': 'NewHLGroup', 'cleared': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1143 \ 'E745:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1144 call assert_fails("call hlset([{'name': 'NewHLGroup', 'cterm': 'Blue'}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1145 \ 'E715:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1146 call assert_fails("call hlset([{'name': 'NewHLGroup', 'ctermbg': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1147 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1148 call assert_fails("call hlset([{'name': 'NewHLGroup', 'ctermfg': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1149 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1150 call assert_fails("call hlset([{'name': 'NewHLGroup', 'ctermul': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1151 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1152 if has('gui')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1153 call assert_fails("call hlset([{'name': 'NewHLGroup', 'font': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1154 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1155 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1156 call assert_fails("call hlset([{'name': 'NewHLGroup', 'gui': 'Cyan'}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1157 \ 'E715:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1158 call assert_fails("call hlset([{'name': 'NewHLGroup', 'guibg': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1159 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1160 call assert_fails("call hlset([{'name': 'NewHLGroup', 'guifg': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1161 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1162 call assert_fails("call hlset([{'name': 'NewHLGroup', 'guisp': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1163 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1164 call assert_fails("call hlset([{'name': 'NewHLGroup', 'linksto': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1165 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1166 call assert_fails("call hlset([{'name': 'NewHLGroup', 'start': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1167 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1168 call assert_fails("call hlset([{'name': 'NewHLGroup', 'stop': []}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1169 \ 'E928:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1170 call assert_fails("call hlset([{'name': 'NewHLGroup', 'term': 'Cyan'}])",
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1171 \ 'E715:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1172 call assert_equal('Search', hlget('NewHLGroup')[0].linksto)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1173 highlight clear NewHLGroup
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1174 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1175 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1176
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1177 " Test for clearing the 'term', 'cterm' and 'gui' attributes of a highlight
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1178 " group.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1179 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1180 highlight myhlg1 term=bold cterm=italic gui=standout
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1181 VAR id = hlID('myhlg1')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1182 call hlset([{'name': 'myhlg1', 'term': {}}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1183 call assert_equal([{'id': id, 'name': 'myhlg1',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1184 \ 'cterm': {'italic': v:true}, 'gui': {'standout': v:true}}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1185 \ hlget('myhlg1'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1186 call hlset([{'name': 'myhlg1', 'cterm': {}}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1187 call assert_equal([{'id': id, 'name': 'myhlg1',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1188 \ 'gui': {'standout': v:true}}], hlget('myhlg1'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1189 call hlset([{'name': 'myhlg1', 'gui': {}}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1190 call assert_equal([{'id': id, 'name': 'myhlg1', 'cleared': v:true}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1191 \ hlget('myhlg1'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1192 highlight clear myhlg1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1193 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1194 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1195
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1196 " Test for setting all the 'term', 'cterm' and 'gui' attributes of a
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1197 " highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1198 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1199 VAR attr = {'bold': v:true, 'underline': v:true,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1200 \ 'undercurl': v:true, 'underdouble': v:true,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1201 \ 'underdotted': v:true, 'underdashed': v:true,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1202 \ 'strikethrough': v:true, 'reverse': v:true, 'italic': v:true,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1203 \ 'standout': v:true, 'nocombine': v:true}
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1204 call hlset([{'name': 'myhlg2', 'term': attr, 'cterm': attr, 'gui': attr}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1205 VAR id2 = hlID('myhlg2')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1206 VAR expected = "myhlg2 xxx term=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough cterm=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough gui=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1207 VAR output = execute('highlight myhlg2')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1208 LET output = output->split("\n")->join()->substitute('\s\+', ' ', 'g')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1209 call assert_equal(expected, output)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1210 call assert_equal([{'id': id2, 'name': 'myhlg2', 'gui': attr,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1211 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1212 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1213 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1214
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1215 " Test for clearing some of the 'term', 'cterm' and 'gui' attributes of a
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1216 " highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1217 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1218 VAR attr = {'bold': v:false, 'underline': v:true, 'strikethrough': v:true}
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1219 call hlset([{'name': 'myhlg2', 'term': attr, 'cterm': attr, 'gui': attr}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1220 VAR id2 = hlID('myhlg2')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1221 VAR expected = "myhlg2 xxx term=underline,strikethrough cterm=underline,strikethrough gui=underline,strikethrough"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1222 VAR output = execute('highlight myhlg2')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1223 LET output = output->split("\n")->join()->substitute('\s\+', ' ', 'g')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1224 call assert_equal(expected, output)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1225 LET attr = {'underline': v:true, 'strikethrough': v:true}
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1226 call assert_equal([{'id': id2, 'name': 'myhlg2', 'gui': attr,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1227 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1228 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1229 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1230
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1231 " Test for clearing the attributes and link of a highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1232 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1233 highlight myhlg3 ctermbg=green guibg=green
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1234 highlight! default link myhlg3 ErrorMsg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1235 VAR id3 = hlID('myhlg3')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1236 call hlset([{'name': 'myhlg3', 'cleared': v:true, 'linksto': 'NONE'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1237 call assert_equal([{'id': id3, 'name': 'myhlg3', 'cleared': v:true}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1238 \ hlget('myhlg3'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1239 highlight clear hlg3
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1240 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1241 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1242
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1243 " Test for setting default attributes for a highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1244 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1245 call hlset([{'name': 'hlg4', 'ctermfg': '8'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1246 call hlset([{'name': 'hlg4', 'default': v:true, 'ctermfg': '9'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1247 VAR id4 = hlID('hlg4')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1248 call assert_equal([{'id': id4, 'name': 'hlg4', 'ctermfg': '8'}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1249 \ hlget('hlg4'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1250 highlight clear hlg4
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1251
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1252 call hlset([{'name': 'hlg5', 'default': v:true, 'ctermbg': '2'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1253 call hlset([{'name': 'hlg5', 'ctermbg': '4'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1254 VAR id5 = hlID('hlg5')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1255 call assert_equal([{'id': id5, 'name': 'hlg5', 'ctermbg': '4'}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1256 \ hlget('hlg5'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1257 highlight clear hlg5
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1258
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1259 call hlset([{'name': 'hlg6', 'linksto': 'Error'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1260 VAR id6 = hlID('hlg6')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1261 call hlset([{'name': 'hlg6', 'default': v:true, 'ctermbg': '2'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1262 call assert_equal([{'id': id6, 'name': 'hlg6', 'linksto': 'Error'}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1263 \ hlget('hlg6'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1264 highlight clear hlg6
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1265 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1266 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1267
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1268 " Test for setting default links for a highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1269 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1270 call hlset([{'name': 'hlg7', 'ctermfg': '5'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1271 call hlset([{'name': 'hlg7', 'default': v:true, 'linksto': 'Search'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1272 VAR id7 = hlID('hlg7')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1273 call assert_equal([{'id': id7, 'name': 'hlg7', 'ctermfg': '5'}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1274 \ hlget('hlg7'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1275 highlight clear hlg7
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1276
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1277 call hlset([{'name': 'hlg8', 'default': v:true, 'linksto': 'Search'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1278 VAR id8 = hlID('hlg8')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1279 call assert_equal([{'id': id8, 'name': 'hlg8', 'default': v:true,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1280 \ 'linksto': 'Search'}], hlget('hlg8'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1281 call hlset([{'name': 'hlg8', 'ctermbg': '2'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1282 call assert_equal([{'id': id8, 'name': 'hlg8', 'ctermbg': '2'}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1283 \ hlget('hlg8'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1284 highlight clear hlg8
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1285
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1286 highlight default link hlg9 ErrorMsg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1287 VAR hlg_save = hlget('hlg9')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1288 LET hlg_save[0]['name'] = 'hlg9dup'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1289 call hlset(hlg_save)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1290 VAR id9 = hlID('hlg9dup')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1291 highlight clear hlg9dup
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1292 call assert_equal([{'id': id9, 'name': 'hlg9dup', 'default': v:true,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1293 \ 'linksto': 'ErrorMsg'}], hlget('hlg9dup'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1294 highlight clear hlg9
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1295 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1296 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1297
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1298 " Test for force creating a link to a highlight group
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1299 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1300 call hlset([{'name': 'hlg10', 'ctermfg': '8'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1301 call hlset([{'name': 'hlg10', 'linksto': 'Search'}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1302 VAR id10 = hlID('hlg10')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1303 call assert_equal([{'id': id10, 'name': 'hlg10', 'ctermfg': '8'}],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1304 \ hlget('hlg10'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1305 call hlset([{'name': 'hlg10', 'linksto': 'Search', 'force': v:true}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1306 call assert_equal([{'id': id10, 'name': 'hlg10', 'ctermfg': '8',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1307 \ 'linksto': 'Search'}], hlget('hlg10'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1308 highlight clear hlg10
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1309 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1310 call v9.CheckLegacyAndVim9Success(lines)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1311
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1312 " Test for empty values of attributes
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1313 call hlset([{'name': 'hlg11', 'cterm': {}}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1314 call hlset([{'name': 'hlg11', 'ctermfg': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1315 call hlset([{'name': 'hlg11', 'ctermbg': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1316 call hlset([{'name': 'hlg11', 'ctermul': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1317 call hlset([{'name': 'hlg11', 'font': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1318 call hlset([{'name': 'hlg11', 'gui': {}}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1319 call hlset([{'name': 'hlg11', 'guifg': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1320 call hlset([{'name': 'hlg11', 'guibg': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1321 call hlset([{'name': 'hlg11', 'guisp': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1322 call hlset([{'name': 'hlg11', 'start': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1323 call hlset([{'name': 'hlg11', 'stop': ''}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1324 call hlset([{'name': 'hlg11', 'term': {}}])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1325 call assert_true(hlget('hlg11')[0].cleared)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1326 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1327
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32588
diff changeset
1328 " vim: shiftwidth=2 sts=2 expandtab