annotate src/testdir/test_highlight.vim @ 27037:a0a37337428a v8.2.4047

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