blob: 22d066fecbe25c0fc1be36e709b14eb22bd31a51 [file] [log] [blame]
Bram Moolenaar0aa398f2017-09-30 21:23:55 +02001" Tests for ":highlight" and highlighting.
2
3source view_util.vim
Bram Moolenaarc07ff5c2019-01-30 21:41:14 +01004source screendump.vim
Bram Moolenaar8c5a2782019-08-07 23:07:07 +02005source check.vim
Bram Moolenaare8df0102020-09-18 19:40:45 +02006source script_util.vim
Bram Moolenaar62aec932022-01-29 21:45:34 +00007import './vim9.vim' as v9
Bram Moolenaar0aa398f2017-09-30 21:23:55 +02008
Drew Vogela0fca172021-11-13 10:50:01 +00009func ClearDict(d)
10 for k in keys(a:d)
11 call remove(a:d, k)
12 endfor
13endfunc
14
Bram Moolenaar75373f32017-08-07 22:02:30 +020015func Test_highlight()
16 " basic test if ":highlight" doesn't crash
17 highlight
18 hi Search
19
20 " test setting colors.
21 " test clearing one color and all doesn't generate error or warning
22 silent! hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan
23 silent! hi Group2 term= cterm=
24 hi Group3 term=underline cterm=bold
25
26 let res = split(execute("hi NewGroup"), "\n")[0]
27 " filter ctermfg and ctermbg, the numbers depend on the terminal
28 let res = substitute(res, 'ctermfg=\d*', 'ctermfg=2', '')
29 let res = substitute(res, 'ctermbg=\d*', 'ctermbg=3', '')
30 call assert_equal("NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3",
31 \ res)
32 call assert_equal("Group2 xxx cleared",
33 \ split(execute("hi Group2"), "\n")[0])
34 call assert_equal("Group3 xxx term=underline cterm=bold",
35 \ split(execute("hi Group3"), "\n")[0])
36
37 hi clear NewGroup
38 call assert_equal("NewGroup xxx cleared",
39 \ split(execute("hi NewGroup"), "\n")[0])
40 call assert_equal("Group2 xxx cleared",
41 \ split(execute("hi Group2"), "\n")[0])
42 hi Group2 NONE
43 call assert_equal("Group2 xxx cleared",
44 \ split(execute("hi Group2"), "\n")[0])
45 hi clear
46 call assert_equal("Group3 xxx cleared",
47 \ split(execute("hi Group3"), "\n")[0])
48 call assert_fails("hi Crash term='asdf", "E475:")
Bram Moolenaar5b9f5722023-02-19 20:49:38 +000049
50 if has('gui_running')
51 call assert_fails('hi NotUsed guibg=none', 'E1361:')
52 endif
Bram Moolenaar75373f32017-08-07 22:02:30 +020053endfunc
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020054
Bram Moolenaar1e115362019-01-09 23:01:02 +010055func HighlightArgs(name)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020056 return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\<xxx\>', '', '')
Bram Moolenaar1e115362019-01-09 23:01:02 +010057endfunc
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020058
Bram Moolenaar1e115362019-01-09 23:01:02 +010059func IsColorable()
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020060 return has('gui_running') || str2nr(&t_Co) >= 8
Bram Moolenaar1e115362019-01-09 23:01:02 +010061endfunc
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020062
Bram Moolenaar1e115362019-01-09 23:01:02 +010063func HiCursorLine()
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020064 let hiCursorLine = HighlightArgs('CursorLine')
65 if has('gui_running')
66 let guibg = matchstr(hiCursorLine, 'guibg=\w\+')
67 let hi_ul = 'hi CursorLine gui=underline guibg=NONE'
68 let hi_bg = 'hi CursorLine gui=NONE ' . guibg
69 else
70 let hi_ul = 'hi CursorLine cterm=underline ctermbg=NONE'
71 let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray'
72 endif
73 return [hiCursorLine, hi_ul, hi_bg]
Bram Moolenaar1e115362019-01-09 23:01:02 +010074endfunc
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020075
Bram Moolenaar1e115362019-01-09 23:01:02 +010076func Check_lcs_eol_attrs(attrs, row, col)
Bram Moolenaar5ece3e32017-10-01 14:35:02 +020077 let save_lcs = &lcs
78 set list
79
80 call assert_equal(a:attrs, ScreenAttrs(a:row, a:col)[0])
81
82 set nolist
83 let &lcs = save_lcs
Bram Moolenaar1e115362019-01-09 23:01:02 +010084endfunc
Bram Moolenaar5ece3e32017-10-01 14:35:02 +020085
Bram Moolenaar0aa398f2017-09-30 21:23:55 +020086func Test_highlight_eol_with_cursorline()
87 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
88
89 call NewWindow('topleft 5', 20)
90 call setline(1, 'abcd')
91 call matchadd('Search', '\n')
92
93 " expected:
94 " 'abcd '
95 " ^^^^ ^^^^^ no highlight
96 " ^ 'Search' highlight
97 let attrs0 = ScreenAttrs(1, 10)[0]
98 call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3])
99 call assert_equal(repeat([attrs0[0]], 5), attrs0[5:9])
100 call assert_notequal(attrs0[0], attrs0[4])
101
102 setlocal cursorline
103
104 " underline
105 exe hi_ul
106
107 " expected:
108 " 'abcd '
109 " ^^^^ underline
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200110 " ^ 'Search' highlight with underline
111 " ^^^^^ underline
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200112 let attrs = ScreenAttrs(1, 10)[0]
113 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
114 call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
115 call assert_notequal(attrs[0], attrs[4])
116 call assert_notequal(attrs[4], attrs[5])
117 call assert_notequal(attrs0[0], attrs[0])
118 call assert_notequal(attrs0[4], attrs[4])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200119 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200120
121 if IsColorable()
122 " bg-color
123 exe hi_bg
124
125 " expected:
126 " 'abcd '
127 " ^^^^ bg-color of 'CursorLine'
128 " ^ 'Search' highlight
129 " ^^^^^ bg-color of 'CursorLine'
130 let attrs = ScreenAttrs(1, 10)[0]
131 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
132 call assert_equal(repeat([attrs[5]], 5), attrs[5:9])
133 call assert_equal(attrs0[4], attrs[4])
134 call assert_notequal(attrs[0], attrs[4])
135 call assert_notequal(attrs[4], attrs[5])
136 call assert_notequal(attrs0[0], attrs[0])
137 call assert_notequal(attrs0[5], attrs[5])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200138 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200139 endif
140
141 call CloseWindow()
142 exe hiCursorLine
143endfunc
144
145func Test_highlight_eol_with_cursorline_vertsplit()
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200146 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
147
148 call NewWindow('topleft 5', 5)
149 call setline(1, 'abcd')
150 call matchadd('Search', '\n')
151
152 let expected = "abcd |abcd "
153 let actual = ScreenLines(1, 15)[0]
154 call assert_equal(expected, actual)
155
156 " expected:
157 " 'abcd |abcd '
158 " ^^^^ ^^^^^^^^^ no highlight
159 " ^ 'Search' highlight
160 " ^ 'VertSplit' highlight
161 let attrs0 = ScreenAttrs(1, 15)[0]
162 call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3])
163 call assert_equal(repeat([attrs0[0]], 9), attrs0[6:14])
164 call assert_notequal(attrs0[0], attrs0[4])
165 call assert_notequal(attrs0[0], attrs0[5])
166 call assert_notequal(attrs0[4], attrs0[5])
167
168 setlocal cursorline
169
170 " expected:
171 " 'abcd |abcd '
172 " ^^^^ underline
173 " ^ 'Search' highlight with underline
174 " ^ 'VertSplit' highlight
175 " ^^^^^^^^^ no highlight
176
177 " underline
178 exe hi_ul
179
180 let actual = ScreenLines(1, 15)[0]
181 call assert_equal(expected, actual)
182
183 let attrs = ScreenAttrs(1, 15)[0]
184 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
185 call assert_equal(repeat([attrs[6]], 9), attrs[6:14])
186 call assert_equal(attrs0[5:14], attrs[5:14])
187 call assert_notequal(attrs[0], attrs[4])
188 call assert_notequal(attrs[0], attrs[5])
189 call assert_notequal(attrs[0], attrs[6])
190 call assert_notequal(attrs[4], attrs[5])
191 call assert_notequal(attrs[5], attrs[6])
192 call assert_notequal(attrs0[0], attrs[0])
193 call assert_notequal(attrs0[4], attrs[4])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200194 call Check_lcs_eol_attrs(attrs, 1, 15)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200195
196 if IsColorable()
197 " bg-color
198 exe hi_bg
199
200 let actual = ScreenLines(1, 15)[0]
201 call assert_equal(expected, actual)
202
203 let attrs = ScreenAttrs(1, 15)[0]
204 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
205 call assert_equal(repeat([attrs[6]], 9), attrs[6:14])
206 call assert_equal(attrs0[5:14], attrs[5:14])
207 call assert_notequal(attrs[0], attrs[4])
208 call assert_notequal(attrs[0], attrs[5])
209 call assert_notequal(attrs[0], attrs[6])
210 call assert_notequal(attrs[4], attrs[5])
211 call assert_notequal(attrs[5], attrs[6])
212 call assert_notequal(attrs0[0], attrs[0])
213 call assert_equal(attrs0[4], attrs[4])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200214 call Check_lcs_eol_attrs(attrs, 1, 15)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200215 endif
216
217 call CloseWindow()
218 exe hiCursorLine
219endfunc
220
221func Test_highlight_eol_with_cursorline_rightleft()
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +0200222 CheckFeature rightleft
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200223
224 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
225
226 call NewWindow('topleft 5', 10)
227 setlocal rightleft
228 call setline(1, 'abcd')
229 call matchadd('Search', '\n')
230 let attrs0 = ScreenAttrs(1, 10)[0]
231
232 setlocal cursorline
233
234 " underline
235 exe hi_ul
236
237 " expected:
238 " ' dcba'
239 " ^^^^ underline
240 " ^ 'Search' highlight with underline
241 " ^^^^^ underline
242 let attrs = ScreenAttrs(1, 10)[0]
243 call assert_equal(repeat([attrs[9]], 4), attrs[6:9])
244 call assert_equal(repeat([attrs[4]], 5) + [attrs[5]], attrs[0:5])
245 call assert_notequal(attrs[9], attrs[5])
246 call assert_notequal(attrs[4], attrs[5])
247 call assert_notequal(attrs0[9], attrs[9])
248 call assert_notequal(attrs0[5], attrs[5])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200249 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200250
251 if IsColorable()
252 " bg-color
253 exe hi_bg
254
255 " expected:
256 " ' dcba'
257 " ^^^^ bg-color of 'CursorLine'
258 " ^ 'Search' highlight
259 " ^^^^^ bg-color of 'CursorLine'
260 let attrs = ScreenAttrs(1, 10)[0]
261 call assert_equal(repeat([attrs[9]], 4), attrs[6:9])
262 call assert_equal(repeat([attrs[4]], 5), attrs[0:4])
263 call assert_equal(attrs0[5], attrs[5])
264 call assert_notequal(attrs[9], attrs[5])
265 call assert_notequal(attrs[5], attrs[4])
266 call assert_notequal(attrs0[9], attrs[9])
267 call assert_notequal(attrs0[4], attrs[4])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200268 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200269 endif
270
271 call CloseWindow()
272 exe hiCursorLine
273endfunc
274
275func Test_highlight_eol_with_cursorline_linewrap()
276 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
277
278 call NewWindow('topleft 5', 10)
279 call setline(1, [repeat('a', 51) . 'bcd', ''])
280 call matchadd('Search', '\n')
281
282 setlocal wrap
283 normal! gg$
284 let attrs0 = ScreenAttrs(5, 10)[0]
285 setlocal cursorline
286
287 " underline
288 exe hi_ul
289
290 " expected:
291 " 'abcd '
292 " ^^^^ underline
293 " ^ 'Search' highlight with underline
294 " ^^^^^ underline
295 let attrs = ScreenAttrs(5, 10)[0]
296 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
297 call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
298 call assert_notequal(attrs[0], attrs[4])
299 call assert_notequal(attrs[4], attrs[5])
300 call assert_notequal(attrs0[0], attrs[0])
301 call assert_notequal(attrs0[4], attrs[4])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200302 call Check_lcs_eol_attrs(attrs, 5, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200303
304 if IsColorable()
305 " bg-color
306 exe hi_bg
307
308 " expected:
309 " 'abcd '
310 " ^^^^ bg-color of 'CursorLine'
311 " ^ 'Search' highlight
312 " ^^^^^ bg-color of 'CursorLine'
313 let attrs = ScreenAttrs(5, 10)[0]
314 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
315 call assert_equal(repeat([attrs[5]], 5), attrs[5:9])
316 call assert_equal(attrs0[4], attrs[4])
317 call assert_notequal(attrs[0], attrs[4])
318 call assert_notequal(attrs[4], attrs[5])
319 call assert_notequal(attrs0[0], attrs[0])
320 call assert_notequal(attrs0[5], attrs[5])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200321 call Check_lcs_eol_attrs(attrs, 5, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200322 endif
323
324 setlocal nocursorline nowrap
325 normal! gg$
326 let attrs0 = ScreenAttrs(1, 10)[0]
327 setlocal cursorline
328
329 " underline
330 exe hi_ul
331
332 " expected:
333 " 'aaabcd '
334 " ^^^^^^ underline
335 " ^ 'Search' highlight with underline
336 " ^^^ underline
337 let attrs = ScreenAttrs(1, 10)[0]
338 call assert_equal(repeat([attrs[0]], 6), attrs[0:5])
339 call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
340 call assert_notequal(attrs[0], attrs[6])
341 call assert_notequal(attrs[6], attrs[7])
342 call assert_notequal(attrs0[0], attrs[0])
343 call assert_notequal(attrs0[6], attrs[6])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200344 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200345
346 if IsColorable()
347 " bg-color
348 exe hi_bg
349
350 " expected:
351 " 'aaabcd '
352 " ^^^^^^ bg-color of 'CursorLine'
353 " ^ 'Search' highlight
354 " ^^^ bg-color of 'CursorLine'
355 let attrs = ScreenAttrs(1, 10)[0]
356 call assert_equal(repeat([attrs[0]], 6), attrs[0:5])
357 call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
358 call assert_equal(attrs0[6], attrs[6])
359 call assert_notequal(attrs[0], attrs[6])
360 call assert_notequal(attrs[6], attrs[7])
361 call assert_notequal(attrs0[0], attrs[0])
362 call assert_notequal(attrs0[7], attrs[7])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200363 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200364 endif
365
366 call CloseWindow()
367 exe hiCursorLine
368endfunc
369
370func Test_highlight_eol_with_cursorline_sign()
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +0200371 CheckFeature signs
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200372
373 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
374
375 call NewWindow('topleft 5', 10)
376 call setline(1, 'abcd')
377 call matchadd('Search', '\n')
378
379 sign define Sign text=>>
380 exe 'sign place 1 line=1 name=Sign buffer=' . bufnr('')
381 let attrs0 = ScreenAttrs(1, 10)[0]
382 setlocal cursorline
383
384 " underline
385 exe hi_ul
386
387 " expected:
388 " '>>abcd '
389 " ^^ sign
390 " ^^^^ underline
391 " ^ 'Search' highlight with underline
392 " ^^^ underline
393 let attrs = ScreenAttrs(1, 10)[0]
394 call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
395 call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
396 call assert_notequal(attrs[2], attrs[6])
397 call assert_notequal(attrs[6], attrs[7])
398 call assert_notequal(attrs0[2], attrs[2])
399 call assert_notequal(attrs0[6], attrs[6])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200400 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200401
402 if IsColorable()
403 " bg-color
404 exe hi_bg
405
406 " expected:
407 " '>>abcd '
408 " ^^ sign
409 " ^^^^ bg-color of 'CursorLine'
410 " ^ 'Search' highlight
411 " ^^^ bg-color of 'CursorLine'
412 let attrs = ScreenAttrs(1, 10)[0]
413 call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
414 call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
415 call assert_equal(attrs0[6], attrs[6])
416 call assert_notequal(attrs[2], attrs[6])
417 call assert_notequal(attrs[6], attrs[7])
418 call assert_notequal(attrs0[2], attrs[2])
419 call assert_notequal(attrs0[7], attrs[7])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200420 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200421 endif
422
423 sign unplace 1
424 call CloseWindow()
425 exe hiCursorLine
426endfunc
427
428func Test_highlight_eol_with_cursorline_breakindent()
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +0200429 CheckFeature linebreak
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200430
431 let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
432
433 call NewWindow('topleft 5', 10)
Bram Moolenaaree857022019-11-09 23:26:40 +0100434 set showbreak=xxx
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200435 setlocal breakindent breakindentopt=min:0,shift:1 showbreak=>
436 call setline(1, ' ' . repeat('a', 9) . 'bcd')
437 call matchadd('Search', '\n')
438 let attrs0 = ScreenAttrs(2, 10)[0]
439 setlocal cursorline
440
441 " underline
442 exe hi_ul
443
444 " expected:
445 " ' >bcd '
446 " ^^^ breakindent and showbreak
447 " ^^^ underline
448 " ^ 'Search' highlight with underline
449 " ^^^ underline
450 let attrs = ScreenAttrs(2, 10)[0]
451 call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
452 call assert_equal(repeat([attrs[3]], 3), attrs[3:5])
453 call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
454 call assert_equal(attrs0[0], attrs[0])
455 call assert_notequal(attrs[0], attrs[2])
456 call assert_notequal(attrs[2], attrs[3])
457 call assert_notequal(attrs[3], attrs[6])
458 call assert_notequal(attrs[6], attrs[7])
459 call assert_notequal(attrs0[2], attrs[2])
460 call assert_notequal(attrs0[3], attrs[3])
461 call assert_notequal(attrs0[6], attrs[6])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200462 call Check_lcs_eol_attrs(attrs, 2, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200463
464 if IsColorable()
465 " bg-color
466 exe hi_bg
467
468 " expected:
469 " ' >bcd '
470 " ^^^ breakindent and showbreak
471 " ^^^ bg-color of 'CursorLine'
472 " ^ 'Search' highlight
473 " ^^^ bg-color of 'CursorLine'
474 let attrs = ScreenAttrs(2, 10)[0]
475 call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
476 call assert_equal(repeat([attrs[3]], 3), attrs[3:5])
477 call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
478 call assert_equal(attrs0[0], attrs[0])
479 call assert_equal(attrs0[6], attrs[6])
480 call assert_notequal(attrs[0], attrs[2])
481 call assert_notequal(attrs[2], attrs[3])
482 call assert_notequal(attrs[3], attrs[6])
483 call assert_notequal(attrs[6], attrs[7])
484 call assert_notequal(attrs0[2], attrs[2])
485 call assert_notequal(attrs0[3], attrs[3])
486 call assert_notequal(attrs0[7], attrs[7])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200487 call Check_lcs_eol_attrs(attrs, 2, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200488 endif
489
490 call CloseWindow()
491 set showbreak=
Bram Moolenaaree857022019-11-09 23:26:40 +0100492 setlocal showbreak=
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200493 exe hiCursorLine
494endfunc
495
496func Test_highlight_eol_on_diff()
497 call setline(1, ['abcd', ''])
498 call matchadd('Search', '\n')
499 let attrs0 = ScreenAttrs(1, 10)[0]
500
501 diffthis
502 botright new
503 diffthis
504
505 " expected:
506 " ' abcd '
507 " ^^ sign
508 " ^^^^ ^^^ 'DiffAdd' highlight
509 " ^ 'Search' highlight
510 let attrs = ScreenAttrs(1, 10)[0]
511 call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
512 call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
513 call assert_equal(repeat([attrs[2]], 3), attrs[7:9])
514 call assert_equal(attrs0[4], attrs[6])
515 call assert_notequal(attrs[0], attrs[2])
516 call assert_notequal(attrs[0], attrs[6])
517 call assert_notequal(attrs[2], attrs[6])
Bram Moolenaar5ece3e32017-10-01 14:35:02 +0200518 call Check_lcs_eol_attrs(attrs, 1, 10)
Bram Moolenaar0aa398f2017-09-30 21:23:55 +0200519
520 bwipe!
521 diffoff
522endfunc
Bram Moolenaarf708ac52018-03-12 21:48:32 +0100523
524func Test_termguicolors()
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +0200525 CheckOption termguicolors
Bram Moolenaar310c32e2019-11-29 23:15:25 +0100526 if has('vtp') && !has('vcon') && !has('gui_running')
Bram Moolenaarff1e8792018-03-12 22:16:37 +0100527 " Win32: 'guicolors' doesn't work without virtual console.
528 call assert_fails('set termguicolors', 'E954:')
529 return
530 endif
Bram Moolenaarf708ac52018-03-12 21:48:32 +0100531
532 " Basic test that setting 'termguicolors' works with one color.
533 set termguicolors
534 redraw
535 set t_Co=1
536 redraw
537 set t_Co=0
538 redraw
539endfunc
Bram Moolenaarc07ff5c2019-01-30 21:41:14 +0100540
541func Test_cursorline_after_yank()
Bram Moolenaar8c5a2782019-08-07 23:07:07 +0200542 CheckScreendump
Bram Moolenaarc07ff5c2019-01-30 21:41:14 +0100543
544 call writefile([
545 \ 'set cul rnu',
546 \ 'call setline(1, ["","1","2","3",""])',
Bram Moolenaar572a4432022-09-28 21:07:03 +0100547 \ ], 'Xtest_cursorline_yank', 'D')
Bram Moolenaarc07ff5c2019-01-30 21:41:14 +0100548 let buf = RunVimInTerminal('-S Xtest_cursorline_yank', {'rows': 8})
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200549 call TermWait(buf)
Bram Moolenaarc07ff5c2019-01-30 21:41:14 +0100550 call term_sendkeys(buf, "Gy3k")
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200551 call TermWait(buf)
Bram Moolenaarc07ff5c2019-01-30 21:41:14 +0100552 call term_sendkeys(buf, "jj")
553
554 call VerifyScreenDump(buf, 'Test_cursorline_yank_01', {})
555
556 " clean up
557 call StopVimInTerminal(buf)
Bram Moolenaarc07ff5c2019-01-30 21:41:14 +0100558endfunc
Bram Moolenaar8156ed32019-03-09 11:46:15 +0100559
Bram Moolenaarfca068b2019-09-08 14:07:47 +0200560" test for issue #4862
561func Test_put_before_cursorline()
562 new
563 only!
564 call setline(1, 'A')
565 redraw
566 let std_attr = screenattr(1, 1)
567 set cursorline
568 redraw
569 let cul_attr = screenattr(1, 1)
570 normal yyP
571 redraw
572 " Line 1 has cursor so it should be highlighted with CursorLine.
573 call assert_equal(cul_attr, screenattr(1, 1))
574 " And CursorLine highlighting from the second line should be gone.
575 call assert_equal(std_attr, screenattr(2, 1))
576 set nocursorline
577 bwipe!
578endfunc
579
Bram Moolenaar8156ed32019-03-09 11:46:15 +0100580func Test_cursorline_with_visualmode()
Bram Moolenaar8c5a2782019-08-07 23:07:07 +0200581 CheckScreendump
Bram Moolenaar8156ed32019-03-09 11:46:15 +0100582
583 call writefile([
584 \ 'set cul',
585 \ 'call setline(1, repeat(["abc"], 50))',
Bram Moolenaar572a4432022-09-28 21:07:03 +0100586 \ ], 'Xtest_cursorline_with_visualmode', 'D')
Bram Moolenaar8156ed32019-03-09 11:46:15 +0100587 let buf = RunVimInTerminal('-S Xtest_cursorline_with_visualmode', {'rows': 12})
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200588 call TermWait(buf)
Bram Moolenaar8156ed32019-03-09 11:46:15 +0100589 call term_sendkeys(buf, "V\<C-f>kkkjk")
590
591 call VerifyScreenDump(buf, 'Test_cursorline_with_visualmode_01', {})
592
593 " clean up
594 call StopVimInTerminal(buf)
Bram Moolenaar8156ed32019-03-09 11:46:15 +0100595endfunc
Bram Moolenaarf90b6e02019-05-09 19:26:38 +0200596
Bram Moolenaar782c6742022-04-01 12:06:31 +0100597func Test_cursorcolumn_insert_on_tab()
598 CheckScreendump
599
600 let lines =<< trim END
601 call setline(1, ['123456789', "a\tb"])
602 set cursorcolumn
603 call cursor(2, 2)
604 END
Bram Moolenaar572a4432022-09-28 21:07:03 +0100605 call writefile(lines, 'Xcuc_insert_on_tab', 'D')
Bram Moolenaar782c6742022-04-01 12:06:31 +0100606
607 let buf = RunVimInTerminal('-S Xcuc_insert_on_tab', #{rows: 8})
608 call TermWait(buf)
609 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_1', {})
610
611 call term_sendkeys(buf, 'i')
612 call TermWait(buf)
613 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
614
zeertzjq8c979602022-04-07 15:08:01 +0100615 call term_sendkeys(buf, "\<C-O>")
616 call TermWait(buf)
617 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_3', {})
618
619 call term_sendkeys(buf, 'i')
620 call TermWait(buf)
621 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
622
Bram Moolenaar782c6742022-04-01 12:06:31 +0100623 call StopVimInTerminal(buf)
Bram Moolenaar782c6742022-04-01 12:06:31 +0100624endfunc
625
zeertzjq3e559cd2022-03-27 19:26:55 +0100626func Test_cursorcolumn_callback()
627 CheckScreendump
628 CheckFeature timers
629
630 let lines =<< trim END
631 call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
632 set cursorcolumn
633 call cursor(4, 5)
634
635 func Func(timer)
636 call cursor(1, 1)
637 endfunc
638
639 call timer_start(300, 'Func')
640 END
Bram Moolenaar572a4432022-09-28 21:07:03 +0100641 call writefile(lines, 'Xcuc_timer', 'D')
zeertzjq3e559cd2022-03-27 19:26:55 +0100642
643 let buf = RunVimInTerminal('-S Xcuc_timer', #{rows: 8})
644 call TermWait(buf, 310)
645 call VerifyScreenDump(buf, 'Test_cursorcolumn_callback_1', {})
646
647 call StopVimInTerminal(buf)
zeertzjq3e559cd2022-03-27 19:26:55 +0100648endfunc
649
Bram Moolenaar193ffd12019-05-25 22:57:30 +0200650func Test_wincolor()
Bram Moolenaar8c5a2782019-08-07 23:07:07 +0200651 CheckScreendump
Bram Moolenaar3180fe62020-02-02 13:47:06 +0100652 " make sure the width is enough for the test
653 set columns=80
Bram Moolenaar193ffd12019-05-25 22:57:30 +0200654
Bram Moolenaare7eb9272019-06-24 00:58:07 +0200655 let lines =<< trim END
656 set cursorline cursorcolumn rnu
Bram Moolenaar053f7122019-09-23 22:17:15 +0200657 call setline(1, ["","1111111111","22222222222","3 here 3","","the cat is out of the bag"])
Bram Moolenaare7eb9272019-06-24 00:58:07 +0200658 set wincolor=Pmenu
Bram Moolenaar053f7122019-09-23 22:17:15 +0200659 hi CatLine guifg=green ctermfg=green
660 hi Reverse gui=reverse cterm=reverse
661 syn match CatLine /^the.*/
662 call prop_type_add("foo", {"highlight": "Reverse", "combine": 1})
663 call prop_add(6, 12, {"type": "foo", "end_col": 15})
Bram Moolenaare7eb9272019-06-24 00:58:07 +0200664 /here
665 END
Bram Moolenaar572a4432022-09-28 21:07:03 +0100666 call writefile(lines, 'Xtest_wincolor', 'D')
Bram Moolenaar193ffd12019-05-25 22:57:30 +0200667 let buf = RunVimInTerminal('-S Xtest_wincolor', {'rows': 8})
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200668 call TermWait(buf)
Bram Moolenaar193ffd12019-05-25 22:57:30 +0200669 call term_sendkeys(buf, "2G5lvj")
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200670 call TermWait(buf)
Bram Moolenaar193ffd12019-05-25 22:57:30 +0200671
672 call VerifyScreenDump(buf, 'Test_wincolor_01', {})
673
674 " clean up
675 call term_sendkeys(buf, "\<Esc>")
676 call StopVimInTerminal(buf)
Bram Moolenaar193ffd12019-05-25 22:57:30 +0200677endfunc
678
Bram Moolenaar42e931b2019-12-04 19:08:50 +0100679func Test_wincolor_listchars()
680 CheckScreendump
Bram Moolenaar705724e2020-01-31 21:13:42 +0100681 CheckFeature conceal
Bram Moolenaar42e931b2019-12-04 19:08:50 +0100682
683 let lines =<< trim END
684 call setline(1, ["one","\t\tsome random text enough long to show 'extends' and 'precedes' includingnbsps, preceding tabs and trailing spaces ","three"])
685 set wincolor=Todo
686 set nowrap cole=1 cocu+=n
687 set list lcs=eol:$,tab:>-,space:.,trail:_,extends:>,precedes:<,conceal:*,nbsp:#
688 call matchadd('Conceal', 'text')
689 normal 2G5zl
690 END
Bram Moolenaar572a4432022-09-28 21:07:03 +0100691 call writefile(lines, 'Xtest_wincolorlcs', 'D')
Bram Moolenaar42e931b2019-12-04 19:08:50 +0100692 let buf = RunVimInTerminal('-S Xtest_wincolorlcs', {'rows': 8})
693
694 call VerifyScreenDump(buf, 'Test_wincolor_lcs', {})
695
696 " clean up
697 call term_sendkeys(buf, "\<Esc>")
698 call StopVimInTerminal(buf)
Bram Moolenaar42e931b2019-12-04 19:08:50 +0100699endfunc
700
Bram Moolenaar010ee962019-09-25 20:37:36 +0200701func Test_colorcolumn()
702 CheckScreendump
703
704 " check that setting 'colorcolumn' when entering a buffer works
705 let lines =<< trim END
706 split
707 edit X
708 call setline(1, ["1111111111","22222222222","3333333333"])
709 set nomodified
710 set colorcolumn=3,9
711 set number cursorline cursorlineopt=number
712 wincmd w
713 buf X
714 END
Bram Moolenaar572a4432022-09-28 21:07:03 +0100715 call writefile(lines, 'Xtest_colorcolumn', 'D')
Bram Moolenaar010ee962019-09-25 20:37:36 +0200716 let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
717 call term_sendkeys(buf, ":\<CR>")
Bram Moolenaar010ee962019-09-25 20:37:36 +0200718 call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
719
720 " clean up
721 call StopVimInTerminal(buf)
Bram Moolenaar010ee962019-09-25 20:37:36 +0200722endfunc
723
Bram Moolenaarad5e5632020-09-15 20:52:26 +0200724func Test_colorcolumn_bri()
725 CheckScreendump
726
727 " check 'colorcolumn' when 'breakindent' is set
728 let lines =<< trim END
729 call setline(1, 'The quick brown fox jumped over the lazy dogs')
730 END
Bram Moolenaar572a4432022-09-28 21:07:03 +0100731 call writefile(lines, 'Xtest_colorcolumn_bri', 'D')
Bram Moolenaarad5e5632020-09-15 20:52:26 +0200732 let buf = RunVimInTerminal('-S Xtest_colorcolumn_bri', {'rows': 10,'columns': 40})
733 call term_sendkeys(buf, ":set co=40 linebreak bri briopt=shift:2 cc=40,41,43\<CR>")
Bram Moolenaarad5e5632020-09-15 20:52:26 +0200734 call VerifyScreenDump(buf, 'Test_colorcolumn_2', {})
735
736 " clean up
737 call StopVimInTerminal(buf)
Bram Moolenaarad5e5632020-09-15 20:52:26 +0200738endfunc
739
740func Test_colorcolumn_sbr()
741 CheckScreendump
742
743 " check 'colorcolumn' when 'showbreak' is set
744 let lines =<< trim END
745 call setline(1, 'The quick brown fox jumped over the lazy dogs')
746 END
Bram Moolenaar572a4432022-09-28 21:07:03 +0100747 call writefile(lines, 'Xtest_colorcolumn_srb', 'D')
Bram Moolenaarad5e5632020-09-15 20:52:26 +0200748 let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40})
749 call term_sendkeys(buf, ":set co=40 showbreak=+++>\\ cc=40,41,43\<CR>")
Bram Moolenaarad5e5632020-09-15 20:52:26 +0200750 call VerifyScreenDump(buf, 'Test_colorcolumn_3', {})
751
752 " clean up
753 call StopVimInTerminal(buf)
Bram Moolenaarad5e5632020-09-15 20:52:26 +0200754endfunc
755
Bram Moolenaarf578ca22023-06-10 19:40:30 +0100756func Test_visual_sbr()
757 CheckScreendump
758
759 " check Visual highlight when 'showbreak' is set
760 let lines =<< trim END
761 set showbreak=>
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.')
763 exe "normal! z1\<CR>"
764 END
765 call writefile(lines, 'Xtest_visual_sbr', 'D')
766 let buf = RunVimInTerminal('-S Xtest_visual_sbr', {'rows': 6,'columns': 60})
767
768 call term_sendkeys(buf, "v$")
769 call VerifyScreenDump(buf, 'Test_visual_sbr_1', {})
770
771 " clean up
772 call term_sendkeys(buf, "\<Esc>")
773 call StopVimInTerminal(buf)
774endfunc
775
Bram Moolenaar6b528fa2019-05-09 20:07:33 +0200776" This test must come before the Test_cursorline test, as it appears this
777" defines the Normal highlighting group anyway.
Bram Moolenaarf90b6e02019-05-09 19:26:38 +0200778func Test_1_highlight_Normalgroup_exists()
Bram Moolenaar435f9f02019-07-03 21:40:16 +0200779 let hlNormal = HighlightArgs('Normal')
780 if !has('gui_running')
Bram Moolenaar6b528fa2019-05-09 20:07:33 +0200781 call assert_match('hi Normal\s*clear', hlNormal)
Bram Moolenaar435f9f02019-07-03 21:40:16 +0200782 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
783 " expect is DEFAULT_FONT of gui_gtk_x11.c
784 call assert_match('hi Normal\s*font=Monospace 10', hlNormal)
Bram Moolenaar0b962e52022-04-03 18:02:37 +0100785 elseif has('gui_motif')
Bram Moolenaar435f9f02019-07-03 21:40:16 +0200786 " expect is DEFAULT_FONT of gui_x11.c
787 call assert_match('hi Normal\s*font=7x13', hlNormal)
788 elseif has('win32')
789 " expect any font
790 call assert_match('hi Normal\s*font=.*', hlNormal)
Bram Moolenaar6b528fa2019-05-09 20:07:33 +0200791 endif
Bram Moolenaarf90b6e02019-05-09 19:26:38 +0200792endfunc
Bram Moolenaar548be7f2019-06-29 03:42:42 +0200793
Bram Moolenaar3180fe62020-02-02 13:47:06 +0100794" Do this test last, sometimes restoring the columns doesn't work
Bram Moolenaaree4e0c12020-04-06 21:35:05 +0200795func Test_z_no_space_before_xxx()
Bram Moolenaar548be7f2019-06-29 03:42:42 +0200796 let l:org_columns = &columns
797 set columns=17
798 let l:hi_StatusLineTermNC = join(split(execute('hi StatusLineTermNC')))
799 call assert_match('StatusLineTermNC xxx', l:hi_StatusLineTermNC)
800 let &columns = l:org_columns
Bram Moolenaaree4e0c12020-04-06 21:35:05 +0200801endfunc
802
803" Test for :highlight command errors
804func Test_highlight_cmd_errors()
805 if has('gui_running')
806 " This test doesn't fail in the MS-Windows console version.
Bram Moolenaar75e15672020-06-28 13:10:22 +0200807 call assert_fails('hi Xcomment ctermbg=fg', 'E419:')
Bram Moolenaaree4e0c12020-04-06 21:35:05 +0200808 call assert_fails('hi Xcomment ctermfg=bg', 'E420:')
Bram Moolenaar75e15672020-06-28 13:10:22 +0200809 call assert_fails('hi Xcomment ctermfg=ul', 'E453:')
erw7f7f7aaf2021-12-07 21:29:20 +0000810 call assert_fails('hi ' .. repeat('a', 201) .. ' ctermfg=black', 'E1249:')
Bram Moolenaaree4e0c12020-04-06 21:35:05 +0200811 endif
812
813 " Try using a very long terminal code. Define a dummy terminal code for this
814 " test.
815 let &t_fo = "\<Esc>1;"
816 let c = repeat("t_fo,", 100) . "t_fo"
817 call assert_fails('exe "hi Xgroup1 start=" . c', 'E422:')
818 let &t_fo = ""
819endfunc
820
Bram Moolenaar75e15672020-06-28 13:10:22 +0200821" Test for 'highlight' option
822func Test_highlight_opt()
823 let save_hl = &highlight
824 call assert_fails('set highlight=j:b', 'E474:')
825 set highlight=f\ r
826 call assert_equal('f r', &highlight)
827 set highlight=fb
828 call assert_equal('fb', &highlight)
829 set highlight=fi
830 call assert_equal('fi', &highlight)
831 set highlight=f-
832 call assert_equal('f-', &highlight)
833 set highlight=fr
834 call assert_equal('fr', &highlight)
835 set highlight=fs
836 call assert_equal('fs', &highlight)
837 set highlight=fu
838 call assert_equal('fu', &highlight)
839 set highlight=fc
840 call assert_equal('fc', &highlight)
841 set highlight=ft
842 call assert_equal('ft', &highlight)
843 call assert_fails('set highlight=fr:Search', 'E474:')
844 set highlight=f:$#
845 call assert_match('W18:', v:statusmsg)
846 let &highlight = save_hl
847endfunc
848
849" Test for User group highlighting used in the statusline
850func Test_highlight_User()
851 CheckNotGui
852 hi User1 ctermfg=12
853 redraw!
854 call assert_equal('12', synIDattr(synIDtrans(hlID('User1')), 'fg'))
855 hi clear
856endfunc
857
858" Test for using RGB color values in a highlight group
Bram Moolenaar09fbedc2021-01-19 17:22:58 +0100859func Test_xxlast_highlight_RGB_color()
860 CheckCanRunGui
861 gui -f
Bram Moolenaar75e15672020-06-28 13:10:22 +0200862 hi MySearch guifg=#110000 guibg=#001100 guisp=#000011
863 call assert_equal('#110000', synIDattr(synIDtrans(hlID('MySearch')), 'fg#'))
864 call assert_equal('#001100', synIDattr(synIDtrans(hlID('MySearch')), 'bg#'))
865 call assert_equal('#000011', synIDattr(synIDtrans(hlID('MySearch')), 'sp#'))
866 hi clear
867endfunc
868
Bram Moolenaarde8f0f42020-06-30 18:45:43 +0200869" Test for using default highlighting group
870func Test_highlight_default()
871 highlight MySearch ctermfg=7
872 highlight default MySearch ctermfg=5
873 let hlSearch = HighlightArgs('MySearch')
874 call assert_match('ctermfg=7', hlSearch)
875
876 highlight default QFName ctermfg=3
877 call assert_match('ctermfg=3', HighlightArgs('QFName'))
878 hi clear
879endfunc
880
881" Test for 'ctermul in a highlight group
882func Test_highlight_ctermul()
883 CheckNotGui
884 call assert_notmatch('ctermul=', HighlightArgs('Normal'))
885 highlight Normal ctermul=3
886 call assert_match('ctermul=3', HighlightArgs('Normal'))
Bram Moolenaar391c3622020-09-29 20:59:17 +0200887 call assert_equal('3', synIDattr(synIDtrans(hlID('Normal')), 'ul'))
Bram Moolenaarde8f0f42020-06-30 18:45:43 +0200888 highlight Normal ctermul=NONE
889endfunc
890
891" Test for specifying 'start' and 'stop' in a highlight group
892func Test_highlight_start_stop()
893 hi HlGrp1 start=<Esc>[27h;<Esc>[<Space>r;
894 call assert_match("start=^[[27h;^[[ r;", HighlightArgs('HlGrp1'))
895 hi HlGrp1 start=NONE
896 call assert_notmatch("start=", HighlightArgs('HlGrp1'))
897 hi HlGrp2 stop=<Esc>[27h;<Esc>[<Space>r;
898 call assert_match("stop=^[[27h;^[[ r;", HighlightArgs('HlGrp2'))
899 hi HlGrp2 stop=NONE
900 call assert_notmatch("stop=", HighlightArgs('HlGrp2'))
Yegappan Lakshmanan5284b232023-03-04 19:57:32 +0000901 set t_xy=^[foo;
902 set t_xz=^[bar;
903 hi HlGrp3 start=t_xy stop=t_xz
904 let d = hlget('HlGrp3')
905 call assert_equal('^[foo;', d[0].start)
906 call assert_equal('^[bar;', d[0].stop)
907 set t_xy= t_xz=
Bram Moolenaarde8f0f42020-06-30 18:45:43 +0200908 hi clear
909endfunc
910
911" Test for setting various 'term' attributes
912func Test_highlight_term_attr()
Bram Moolenaar84f54632022-06-29 18:39:11 +0100913 hi HlGrp3 term=bold,underline,undercurl,underdouble,underdotted,underdashed,strikethrough,reverse,italic,standout
914 call assert_equal('hi HlGrp3 term=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough', HighlightArgs('HlGrp3'))
Bram Moolenaarde8f0f42020-06-30 18:45:43 +0200915 hi HlGrp3 term=NONE
916 call assert_equal('hi HlGrp3 cleared', HighlightArgs('HlGrp3'))
917 hi clear
918endfunc
919
Bram Moolenaar213da552020-09-17 19:59:26 +0200920func Test_highlight_clear_restores_links()
921 let aaa_id = hlID('aaa')
922 call assert_equal(aaa_id, 0)
923
924 " create default link aaa --> bbb
925 hi def link aaa bbb
926 let id_aaa = hlID('aaa')
927 let hl_aaa_bbb = HighlightArgs('aaa')
928
929 " try to redefine default link aaa --> ccc; check aaa --> bbb
930 hi def link aaa ccc
931 call assert_equal(HighlightArgs('aaa'), hl_aaa_bbb)
932
933 " clear aaa; check aaa --> bbb
934 hi clear aaa
935 call assert_equal(HighlightArgs('aaa'), hl_aaa_bbb)
936
937 " link aaa --> ccc; clear aaa; check aaa --> bbb
938 hi link aaa ccc
939 let id_ccc = hlID('ccc')
940 call assert_equal(synIDtrans(id_aaa), id_ccc)
941 hi clear aaa
942 call assert_equal(HighlightArgs('aaa'), hl_aaa_bbb)
943
944 " forcibly set default link aaa --> ddd
945 hi! def link aaa ddd
946 let id_ddd = hlID('ddd')
947 let hl_aaa_ddd = HighlightArgs('aaa')
948 call assert_equal(synIDtrans(id_aaa), id_ddd)
949
950 " link aaa --> eee; clear aaa; check aaa --> ddd
951 hi link aaa eee
952 let eee_id = hlID('eee')
953 call assert_equal(synIDtrans(id_aaa), eee_id)
954 hi clear aaa
955 call assert_equal(HighlightArgs('aaa'), hl_aaa_ddd)
956endfunc
957
Bram Moolenaare8df0102020-09-18 19:40:45 +0200958func Test_highlight_clear_restores_context()
959 func FuncContextDefault()
960 hi def link Context ContextDefault
961 endfun
962
963 func FuncContextRelink()
964 " Dummy line
965 hi link Context ContextRelink
966 endfunc
967
968 let scriptContextDefault = MakeScript("FuncContextDefault")
969 let scriptContextRelink = MakeScript("FuncContextRelink")
970 let patContextDefault = fnamemodify(scriptContextDefault, ':t') .. ' line 1'
971 let patContextRelink = fnamemodify(scriptContextRelink, ':t') .. ' line 2'
972
Bram Moolenaar2bbada82020-09-18 21:55:26 +0200973 exec 'source ' .. scriptContextDefault
Bram Moolenaare8df0102020-09-18 19:40:45 +0200974 let hlContextDefault = execute("verbose hi Context")
975 call assert_match(patContextDefault, hlContextDefault)
976
Bram Moolenaar2bbada82020-09-18 21:55:26 +0200977 exec 'source ' .. scriptContextRelink
Bram Moolenaare8df0102020-09-18 19:40:45 +0200978 let hlContextRelink = execute("verbose hi Context")
979 call assert_match(patContextRelink, hlContextRelink)
980
981 hi clear
982 let hlContextAfterClear = execute("verbose hi Context")
983 call assert_match(patContextDefault, hlContextAfterClear)
984
985 delfunc FuncContextDefault
986 delfunc FuncContextRelink
987 call delete(scriptContextDefault)
988 call delete(scriptContextRelink)
989endfunc
990
Bram Moolenaar213da552020-09-17 19:59:26 +0200991func Test_highlight_default_colorscheme_restores_links()
992 hi link TestLink Identifier
993 hi TestHi ctermbg=red
Bram Moolenaar05eb5b92020-09-16 15:43:21 +0200994
995 let hlTestLinkPre = HighlightArgs('TestLink')
996 let hlTestHiPre = HighlightArgs('TestHi')
997
998 " Test colorscheme
Dominique Pelle8bfa0eb2022-01-02 16:16:33 +0000999 call assert_equal("\ndefault", execute('colorscheme'))
Bram Moolenaar05eb5b92020-09-16 15:43:21 +02001000 hi clear
1001 if exists('syntax_on')
1002 syntax reset
1003 endif
1004 let g:colors_name = 'test'
Dominique Pelle8bfa0eb2022-01-02 16:16:33 +00001005 call assert_equal("\ntest", execute('colorscheme'))
Bram Moolenaar213da552020-09-17 19:59:26 +02001006 hi link TestLink ErrorMsg
1007 hi TestHi ctermbg=green
Bram Moolenaar05eb5b92020-09-16 15:43:21 +02001008
1009 " Restore default highlighting
1010 colorscheme default
Bram Moolenaar05eb5b92020-09-16 15:43:21 +02001011 " 'default' should work no matter if highlight group was cleared
Dominique Pelle8bfa0eb2022-01-02 16:16:33 +00001012 call assert_equal("\ndefault", execute('colorscheme'))
Bram Moolenaar05eb5b92020-09-16 15:43:21 +02001013 hi def link TestLink Identifier
1014 hi def TestHi ctermbg=red
Bram Moolenaar05eb5b92020-09-16 15:43:21 +02001015 let hlTestLinkPost = HighlightArgs('TestLink')
1016 let hlTestHiPost = HighlightArgs('TestHi')
Bram Moolenaar05eb5b92020-09-16 15:43:21 +02001017 call assert_equal(hlTestLinkPre, hlTestLinkPost)
1018 call assert_equal(hlTestHiPre, hlTestHiPost)
1019 hi clear
1020endfunc
1021
Drew Vogele30d1022021-10-24 20:35:07 +01001022func Test_colornames_assignment_and_lookup()
Drew Vogela0fca172021-11-13 10:50:01 +00001023 CheckAnyOf Feature:gui_running Feature:termguicolors
1024
Drew Vogele30d1022021-10-24 20:35:07 +01001025 " Ensure highlight command can find custom color.
1026 let v:colornames['a redish white'] = '#ffeedd'
1027 highlight Normal guifg='a redish white'
1028 highlight clear
Drew Vogela0fca172021-11-13 10:50:01 +00001029 call ClearDict(v:colornames)
Drew Vogele30d1022021-10-24 20:35:07 +01001030endfunc
1031
1032func Test_colornames_default_list()
Drew Vogela0fca172021-11-13 10:50:01 +00001033 CheckAnyOf Feature:gui_running Feature:termguicolors
1034
Drew Vogele30d1022021-10-24 20:35:07 +01001035 " Ensure default lists are loaded automatically and can be used for all gui fields.
Drew Vogela0fca172021-11-13 10:50:01 +00001036 call assert_equal(0, len(v:colornames))
Drew Vogele30d1022021-10-24 20:35:07 +01001037 highlight Normal guifg='rebecca purple' guibg='rebecca purple' guisp='rebecca purple'
Drew Vogela0fca172021-11-13 10:50:01 +00001038 call assert_notequal(0, len(v:colornames))
1039 echo v:colornames['rebecca purple']
Drew Vogele30d1022021-10-24 20:35:07 +01001040 highlight clear
Drew Vogela0fca172021-11-13 10:50:01 +00001041 call ClearDict(v:colornames)
Drew Vogele30d1022021-10-24 20:35:07 +01001042endfunc
1043
1044func Test_colornames_overwrite_default()
Drew Vogela0fca172021-11-13 10:50:01 +00001045 CheckAnyOf Feature:gui_running Feature:termguicolors
1046
Drew Vogele30d1022021-10-24 20:35:07 +01001047 " Ensure entries in v:colornames can be overwritten.
1048 " Load default color scheme to trigger default color list loading.
1049 colorscheme default
1050 let old_rebecca_purple = v:colornames['rebecca purple']
1051 highlight Normal guifg='rebecca purple' guibg='rebecca purple'
1052 let v:colornames['rebecca purple'] = '#550099'
1053 highlight Normal guifg='rebecca purple' guibg='rebecca purple'
1054 let v:colornames['rebecca purple'] = old_rebecca_purple
1055 highlight clear
1056endfunc
1057
1058func Test_colornames_assignment_and_unassignment()
Drew Vogela0fca172021-11-13 10:50:01 +00001059 " No feature check is needed for this test because the v:colornames dict
1060 " always exists with +eval. The feature checks are only required for
1061 " commands that do color lookup.
1062
Drew Vogele30d1022021-10-24 20:35:07 +01001063 " Ensure we cannot overwrite the v:colornames dict.
1064 call assert_fails("let v:colornames = {}", 'E46:')
1065
1066 " Ensure we can delete entries from the v:colornames dict.
1067 let v:colornames['x1'] = '#111111'
1068 call assert_equal(v:colornames['x1'], '#111111')
1069 unlet v:colornames['x1']
1070 call assert_fails("echo v:colornames['x1']")
1071endfunc
1072
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001073" Test for the hlget() function
1074func Test_hlget()
1075 let lines =<< trim END
1076 call assert_notequal([], filter(hlget(), 'v:val.name == "Visual"'))
1077 call assert_equal([], hlget('SomeHLGroup'))
1078 highlight MyHLGroup term=standout cterm=reverse ctermfg=10 ctermbg=Black
1079 call assert_equal([{'id': hlID('MyHLGroup'), 'ctermfg': '10', 'name': 'MyHLGroup', 'term': {'standout': v:true}, 'ctermbg': '0', 'cterm': {'reverse': v:true}}], hlget('MyHLGroup'))
1080 highlight clear MyHLGroup
1081 call assert_equal(v:true, hlget('MyHLGroup')[0].cleared)
1082 highlight link MyHLGroup IncSearch
1083 call assert_equal('IncSearch', hlget('MyHLGroup')[0].linksto)
1084 highlight clear MyHLGroup
1085 call assert_equal([], hlget(test_null_string()))
1086 call assert_equal([], hlget(""))
1087 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001088 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001089
1090 " Test for resolving highlight group links
1091 let lines =<< trim END
1092 highlight hlgA term=bold
1093 VAR hlgAid = hlID('hlgA')
1094 highlight link hlgB hlgA
1095 VAR hlgBid = hlID('hlgB')
1096 highlight link hlgC hlgB
1097 VAR hlgCid = hlID('hlgC')
1098 call assert_equal('hlgA', hlget('hlgB')[0].linksto)
1099 call assert_equal('hlgB', hlget('hlgC')[0].linksto)
1100 call assert_equal([{'id': hlgAid, 'name': 'hlgA',
1101 \ 'term': {'bold': v:true}}], hlget('hlgA'))
1102 call assert_equal([{'id': hlgBid, 'name': 'hlgB',
1103 \ 'linksto': 'hlgA'}], hlget('hlgB'))
1104 call assert_equal([{'id': hlgCid, 'name': 'hlgC',
1105 \ 'linksto': 'hlgB'}], hlget('hlgC'))
1106 call assert_equal([{'id': hlgAid, 'name': 'hlgA',
1107 \ 'term': {'bold': v:true}}], hlget('hlgA', v:false))
1108 call assert_equal([{'id': hlgBid, 'name': 'hlgB',
1109 \ 'linksto': 'hlgA'}], hlget('hlgB', 0))
1110 call assert_equal([{'id': hlgCid, 'name': 'hlgC',
1111 \ 'linksto': 'hlgB'}], hlget('hlgC', v:false))
1112 call assert_equal([{'id': hlgAid, 'name': 'hlgA',
1113 \ 'term': {'bold': v:true}}], hlget('hlgA', v:true))
1114 call assert_equal([{'id': hlgBid, 'name': 'hlgB',
1115 \ 'term': {'bold': v:true}}], hlget('hlgB', 1))
1116 call assert_equal([{'id': hlgCid, 'name': 'hlgC',
1117 \ 'term': {'bold': v:true}}], hlget('hlgC', v:true))
1118 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001119 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001120
1121 call assert_fails('call hlget([])', 'E1174:')
1122 call assert_fails('call hlget("abc", "xyz")', 'E1212:')
1123endfunc
1124
1125" Test for the hlset() function
1126func Test_hlset()
1127 let lines =<< trim END
1128 call assert_equal(0, hlset(test_null_list()))
1129 call assert_equal(0, hlset([]))
1130 call assert_fails('call hlset(["Search"])', 'E715:')
1131 call hlset(hlget())
1132 call hlset([{'name': 'NewHLGroup', 'cterm': {'reverse': v:true}, 'ctermfg': '10'}])
1133 call assert_equal({'reverse': v:true}, hlget('NewHLGroup')[0].cterm)
1134 call hlset([{'name': 'NewHLGroup', 'cterm': {'bold': v:true}}])
1135 call assert_equal({'bold': v:true}, hlget('NewHLGroup')[0].cterm)
1136 call hlset([{'name': 'NewHLGroup', 'cleared': v:true}])
1137 call assert_equal(v:true, hlget('NewHLGroup')[0].cleared)
1138 call hlset([{'name': 'NewHLGroup', 'linksto': 'Search'}])
1139 call assert_false(has_key(hlget('NewHLGroup')[0], 'cleared'))
1140 call assert_equal('Search', hlget('NewHLGroup')[0].linksto)
1141 call assert_fails("call hlset([{'name': [], 'ctermfg': '10'}])", 'E928:')
1142 call assert_fails("call hlset([{'name': 'NewHLGroup', 'cleared': []}])",
1143 \ 'E745:')
1144 call assert_fails("call hlset([{'name': 'NewHLGroup', 'cterm': 'Blue'}])",
1145 \ 'E715:')
1146 call assert_fails("call hlset([{'name': 'NewHLGroup', 'ctermbg': []}])",
1147 \ 'E928:')
1148 call assert_fails("call hlset([{'name': 'NewHLGroup', 'ctermfg': []}])",
1149 \ 'E928:')
1150 call assert_fails("call hlset([{'name': 'NewHLGroup', 'ctermul': []}])",
1151 \ 'E928:')
1152 if has('gui')
1153 call assert_fails("call hlset([{'name': 'NewHLGroup', 'font': []}])",
1154 \ 'E928:')
1155 endif
1156 call assert_fails("call hlset([{'name': 'NewHLGroup', 'gui': 'Cyan'}])",
1157 \ 'E715:')
1158 call assert_fails("call hlset([{'name': 'NewHLGroup', 'guibg': []}])",
1159 \ 'E928:')
1160 call assert_fails("call hlset([{'name': 'NewHLGroup', 'guifg': []}])",
1161 \ 'E928:')
1162 call assert_fails("call hlset([{'name': 'NewHLGroup', 'guisp': []}])",
1163 \ 'E928:')
1164 call assert_fails("call hlset([{'name': 'NewHLGroup', 'linksto': []}])",
1165 \ 'E928:')
1166 call assert_fails("call hlset([{'name': 'NewHLGroup', 'start': []}])",
1167 \ 'E928:')
1168 call assert_fails("call hlset([{'name': 'NewHLGroup', 'stop': []}])",
1169 \ 'E928:')
1170 call assert_fails("call hlset([{'name': 'NewHLGroup', 'term': 'Cyan'}])",
1171 \ 'E715:')
1172 call assert_equal('Search', hlget('NewHLGroup')[0].linksto)
1173 highlight clear NewHLGroup
1174 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001175 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001176
1177 " Test for clearing the 'term', 'cterm' and 'gui' attributes of a highlight
1178 " group.
1179 let lines =<< trim END
1180 highlight myhlg1 term=bold cterm=italic gui=standout
1181 VAR id = hlID('myhlg1')
1182 call hlset([{'name': 'myhlg1', 'term': {}}])
1183 call assert_equal([{'id': id, 'name': 'myhlg1',
1184 \ 'cterm': {'italic': v:true}, 'gui': {'standout': v:true}}],
1185 \ hlget('myhlg1'))
1186 call hlset([{'name': 'myhlg1', 'cterm': {}}])
1187 call assert_equal([{'id': id, 'name': 'myhlg1',
1188 \ 'gui': {'standout': v:true}}], hlget('myhlg1'))
1189 call hlset([{'name': 'myhlg1', 'gui': {}}])
1190 call assert_equal([{'id': id, 'name': 'myhlg1', 'cleared': v:true}],
1191 \ hlget('myhlg1'))
1192 highlight clear myhlg1
1193 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001194 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001195
1196 " Test for setting all the 'term', 'cterm' and 'gui' attributes of a
1197 " highlight group
1198 let lines =<< trim END
Bram Moolenaar84f54632022-06-29 18:39:11 +01001199 VAR attr = {'bold': v:true, 'underline': v:true,
1200 \ 'undercurl': v:true, 'underdouble': v:true,
1201 \ 'underdotted': v:true, 'underdashed': v:true,
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001202 \ 'strikethrough': v:true, 'reverse': v:true, 'italic': v:true,
1203 \ 'standout': v:true, 'nocombine': v:true}
1204 call hlset([{'name': 'myhlg2', 'term': attr, 'cterm': attr, 'gui': attr}])
1205 VAR id2 = hlID('myhlg2')
Bram Moolenaar84f54632022-06-29 18:39:11 +01001206 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"
Yegappan Lakshmanan2a16dc62021-11-16 17:19:30 +00001207 VAR output = execute('highlight myhlg2')
1208 LET output = output->split("\n")->join()->substitute('\s\+', ' ', 'g')
1209 call assert_equal(expected, output)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001210 call assert_equal([{'id': id2, 'name': 'myhlg2', 'gui': attr,
1211 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
1212 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001213 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001214
1215 " Test for clearing some of the 'term', 'cterm' and 'gui' attributes of a
1216 " highlight group
1217 let lines =<< trim END
1218 VAR attr = {'bold': v:false, 'underline': v:true, 'strikethrough': v:true}
1219 call hlset([{'name': 'myhlg2', 'term': attr, 'cterm': attr, 'gui': attr}])
1220 VAR id2 = hlID('myhlg2')
Yegappan Lakshmanan2a16dc62021-11-16 17:19:30 +00001221 VAR expected = "myhlg2 xxx term=underline,strikethrough cterm=underline,strikethrough gui=underline,strikethrough"
1222 VAR output = execute('highlight myhlg2')
1223 LET output = output->split("\n")->join()->substitute('\s\+', ' ', 'g')
1224 call assert_equal(expected, output)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001225 LET attr = {'underline': v:true, 'strikethrough': v:true}
1226 call assert_equal([{'id': id2, 'name': 'myhlg2', 'gui': attr,
1227 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
1228 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001229 call v9.CheckLegacyAndVim9Success(lines)
Dominique Pelle6a950a62021-11-13 18:44:37 +00001230
Yegappan Lakshmanan2a16dc62021-11-16 17:19:30 +00001231 " Test for clearing the attributes and link of a highlight group
1232 let lines =<< trim END
1233 highlight myhlg3 ctermbg=green guibg=green
1234 highlight! default link myhlg3 ErrorMsg
1235 VAR id3 = hlID('myhlg3')
1236 call hlset([{'name': 'myhlg3', 'cleared': v:true, 'linksto': 'NONE'}])
1237 call assert_equal([{'id': id3, 'name': 'myhlg3', 'cleared': v:true}],
1238 \ hlget('myhlg3'))
1239 highlight clear hlg3
1240 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001241 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanan2a16dc62021-11-16 17:19:30 +00001242
1243 " Test for setting default attributes for a highlight group
1244 let lines =<< trim END
1245 call hlset([{'name': 'hlg4', 'ctermfg': '8'}])
1246 call hlset([{'name': 'hlg4', 'default': v:true, 'ctermfg': '9'}])
1247 VAR id4 = hlID('hlg4')
1248 call assert_equal([{'id': id4, 'name': 'hlg4', 'ctermfg': '8'}],
1249 \ hlget('hlg4'))
1250 highlight clear hlg4
1251
1252 call hlset([{'name': 'hlg5', 'default': v:true, 'ctermbg': '2'}])
1253 call hlset([{'name': 'hlg5', 'ctermbg': '4'}])
1254 VAR id5 = hlID('hlg5')
1255 call assert_equal([{'id': id5, 'name': 'hlg5', 'ctermbg': '4'}],
1256 \ hlget('hlg5'))
1257 highlight clear hlg5
1258
1259 call hlset([{'name': 'hlg6', 'linksto': 'Error'}])
1260 VAR id6 = hlID('hlg6')
1261 call hlset([{'name': 'hlg6', 'default': v:true, 'ctermbg': '2'}])
1262 call assert_equal([{'id': id6, 'name': 'hlg6', 'linksto': 'Error'}],
1263 \ hlget('hlg6'))
1264 highlight clear hlg6
1265 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001266 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanan2a16dc62021-11-16 17:19:30 +00001267
1268 " Test for setting default links for a highlight group
1269 let lines =<< trim END
1270 call hlset([{'name': 'hlg7', 'ctermfg': '5'}])
1271 call hlset([{'name': 'hlg7', 'default': v:true, 'linksto': 'Search'}])
1272 VAR id7 = hlID('hlg7')
1273 call assert_equal([{'id': id7, 'name': 'hlg7', 'ctermfg': '5'}],
1274 \ hlget('hlg7'))
1275 highlight clear hlg7
1276
1277 call hlset([{'name': 'hlg8', 'default': v:true, 'linksto': 'Search'}])
1278 VAR id8 = hlID('hlg8')
1279 call assert_equal([{'id': id8, 'name': 'hlg8', 'default': v:true,
1280 \ 'linksto': 'Search'}], hlget('hlg8'))
1281 call hlset([{'name': 'hlg8', 'ctermbg': '2'}])
1282 call assert_equal([{'id': id8, 'name': 'hlg8', 'ctermbg': '2'}],
1283 \ hlget('hlg8'))
1284 highlight clear hlg8
1285
1286 highlight default link hlg9 ErrorMsg
1287 VAR hlg_save = hlget('hlg9')
1288 LET hlg_save[0]['name'] = 'hlg9dup'
1289 call hlset(hlg_save)
1290 VAR id9 = hlID('hlg9dup')
1291 highlight clear hlg9dup
1292 call assert_equal([{'id': id9, 'name': 'hlg9dup', 'default': v:true,
1293 \ 'linksto': 'ErrorMsg'}], hlget('hlg9dup'))
1294 highlight clear hlg9
1295 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001296 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmanan2a16dc62021-11-16 17:19:30 +00001297
1298 " Test for force creating a link to a highlight group
1299 let lines =<< trim END
1300 call hlset([{'name': 'hlg10', 'ctermfg': '8'}])
1301 call hlset([{'name': 'hlg10', 'linksto': 'Search'}])
1302 VAR id10 = hlID('hlg10')
1303 call assert_equal([{'id': id10, 'name': 'hlg10', 'ctermfg': '8'}],
1304 \ hlget('hlg10'))
1305 call hlset([{'name': 'hlg10', 'linksto': 'Search', 'force': v:true}])
1306 call assert_equal([{'id': id10, 'name': 'hlg10', 'ctermfg': '8',
1307 \ 'linksto': 'Search'}], hlget('hlg10'))
1308 highlight clear hlg10
1309 END
Bram Moolenaar62aec932022-01-29 21:45:34 +00001310 call v9.CheckLegacyAndVim9Success(lines)
Yegappan Lakshmananbb277fd2021-11-24 20:28:31 +00001311
1312 " Test for empty values of attributes
1313 call hlset([{'name': 'hlg11', 'cterm': {}}])
1314 call hlset([{'name': 'hlg11', 'ctermfg': ''}])
1315 call hlset([{'name': 'hlg11', 'ctermbg': ''}])
1316 call hlset([{'name': 'hlg11', 'ctermul': ''}])
1317 call hlset([{'name': 'hlg11', 'font': ''}])
1318 call hlset([{'name': 'hlg11', 'gui': {}}])
1319 call hlset([{'name': 'hlg11', 'guifg': ''}])
1320 call hlset([{'name': 'hlg11', 'guibg': ''}])
1321 call hlset([{'name': 'hlg11', 'guisp': ''}])
1322 call hlset([{'name': 'hlg11', 'start': ''}])
1323 call hlset([{'name': 'hlg11', 'stop': ''}])
1324 call hlset([{'name': 'hlg11', 'term': {}}])
1325 call assert_true(hlget('hlg11')[0].cleared)
Yegappan Lakshmanand1a8d652021-11-03 21:56:45 +00001326endfunc
1327
Bram Moolenaaree4e0c12020-04-06 21:35:05 +02001328" vim: shiftwidth=2 sts=2 expandtab