annotate src/testdir/test_highlight.vim @ 26109:efc174960b10 v8.2.3587

patch 8.2.3587: compiler test fails with backslash file separator Commit: https://github.com/vim/vim/commit/0a15c7676bccb0c9483579106318e785c6e40a7f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Nov 12 16:09:54 2021 +0000 patch 8.2.3587: compiler test fails with backslash file separator Problem: Compiler test fails with backslash file separator. Solution: Accept slash and backslash.
author Bram Moolenaar <Bram@vim.org>
date Fri, 12 Nov 2021 17:15:05 +0100
parents c544eacaf066
children bb87ce13e7d6
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
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 func Test_highlight()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " 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
11 highlight
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 hi Search
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " test setting colors.
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " 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
16 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
17 silent! hi Group2 term= cterm=
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 hi Group3 term=underline cterm=bold
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 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
21 " 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
22 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
23 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
24 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
25 \ res)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 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
29 \ split(execute("hi Group3"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 hi clear NewGroup
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal("NewGroup xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ split(execute("hi NewGroup"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 hi Group2 NONE
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 hi clear
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal("Group3 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 \ split(execute("hi Group3"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 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
43 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
44
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
45 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
46 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
47 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
48
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
49 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
50 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
51 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
52
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
53 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
54 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
55 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
56 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
57 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
58 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
59 else
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
60 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
61 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
62 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
63 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
64 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
65
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
66 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
67 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
68 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
69
97f0c74976c6 patch 8.0.1169: highlignting one char too many with 'list' and 'cul'
Christian Brabandt <cb@256bit.org>
parents: 12580
diff changeset
70 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
71
97f0c74976c6 patch 8.0.1169: highlignting one char too many with 'list' and 'cul'
Christian Brabandt <cb@256bit.org>
parents: 12580
diff changeset
72 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
73 let &lcs = save_lcs
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
74 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
75
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
76 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
77 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
78
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
79 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
80 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
81 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
82
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
83 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
84 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
85 " ^^^^ ^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
86 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
87 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
88 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
89 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
90 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
91
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
92 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
93
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
94 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
95 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
96
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
97 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
98 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
99 " ^^^^ 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
100 " ^ '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
101 " ^^^^^ underline
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
102 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
103 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
104 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
105 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
106 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
107 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
108 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
109 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
110
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
111 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
112 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
113 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
114
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
115 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
116 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
117 " ^^^^ 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
118 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
119 " ^^^^^ 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
120 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
121 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
122 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
123 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
124 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
125 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
126 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
127 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
128 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
129 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
130
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
131 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
132 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
133 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
134
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
135 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
136 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
137
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
138 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
139 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
140 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
141
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
142 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
143 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
144 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
145
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
146 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
147 " 'abcd |abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
148 " ^^^^ ^^^^^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
149 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
150 " ^ 'VertSplit' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
151 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
152 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
153 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
154 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
155 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
156 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
157
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
158 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
159
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
160 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
161 " 'abcd |abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
162 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
163 " ^ '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
164 " ^ 'VertSplit' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
165 " ^^^^^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
166
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
167 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
168 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
169
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
170 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
171 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
172
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184 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
185
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
186 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
187 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
188 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
189
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
190 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
191 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
192
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
193 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
194 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
195 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
196 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
197 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
198 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
199 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
200 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
201 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
202 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
203 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
204 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
205 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
206
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
207 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
208 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
209 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
210
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
211 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
212 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
213
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
214 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
215
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
216 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
217 setlocal rightleft
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
218 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
219 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
220 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
221
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
222 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
223
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
224 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
225 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
226
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
227 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
228 " ' dcba'
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
229 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
230 " ^ '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
231 " ^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
232 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
233 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
234 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
235 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
236 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
237 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
238 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
239 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
240
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
241 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
242 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
243 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
244
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
245 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
246 " ' dcba'
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
247 " ^^^^ 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
248 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
249 " ^^^^^ 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
250 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
251 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
252 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
253 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
254 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
255 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
256 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
257 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
258 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
259 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
260
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
261 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
262 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
263 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
264
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
265 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
266 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
267
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
268 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
269 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
270 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
271
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
272 setlocal wrap
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
273 normal! gg$
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
274 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
275 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
276
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
277 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
278 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
279
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
280 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
281 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
282 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
283 " ^ '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
284 " ^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
285 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
286 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
287 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
288 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
289 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
290 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
291 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
292 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
293
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
294 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
295 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
296 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
297
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
298 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
299 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
300 " ^^^^ 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
301 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
302 " ^^^^^ 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
303 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
304 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
305 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
306 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
307 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
308 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
309 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
310 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
311 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
312 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
313
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
314 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
315 normal! gg$
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
316 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
317 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
318
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
319 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
320 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
321
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
322 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
323 " 'aaabcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
324 " ^^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
325 " ^ '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
326 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 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
335
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
336 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
337 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
338 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
339
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
340 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
341 " 'aaabcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
342 " ^^^^^^ 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
343 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
344 " ^^^ 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
345 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
346 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
347 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
348 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
349 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
350 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
351 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
352 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
353 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
354 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
355
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
356 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
357 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
358 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
359
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
360 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
361 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
362
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
363 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
364
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
365 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
366 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
367 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
368
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
369 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
370 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
371 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
372 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
373
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
374 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
375 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
376
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
377 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
378 " '>>abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
379 " ^^ sign
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 " ^ '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
382 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
383 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
384 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
385 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
386 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
387 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
388 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
389 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
390 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
391
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
392 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
393 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
394 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
395
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
396 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
397 " '>>abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
398 " ^^ sign
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 of 'CursorLine'
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
400 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
401 " ^^^ 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
402 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
403 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
404 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
405 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
406 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
407 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
408 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
409 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
410 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
411 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
412
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
413 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
414 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
415 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
416 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
417
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
418 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
419 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
420
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
421 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
422
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
423 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
424 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
425 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
426 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
427 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
428 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
429 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
430
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
431 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
432 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
433
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
434 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
435 " ' >bcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
436 " ^^^ 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
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 " ^ '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
439 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
440 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
441 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
442 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
443 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
444 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
445 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
446 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
447 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
448 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
449 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
450 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
451 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
452 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
453
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
454 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
455 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
456 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
457
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
458 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
459 " ' >bcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
460 " ^^^ 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
461 " ^^^ 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
462 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
463 " ^^^ 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
464 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
465 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
466 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
467 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
468 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
469 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
470 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
471 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
472 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
473 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
474 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
475 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
476 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
477 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
478 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
479
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
480 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
481 set showbreak=
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18156
diff changeset
482 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
483 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
484 endfunc
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 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
487 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
488 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
489 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
490
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
491 diffthis
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
492 botright new
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
493 diffthis
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
494
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
495 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
496 " ' abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
497 " ^^ sign
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
498 " ^^^^ ^^^ 'DiffAdd' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
499 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
500 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
501 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
502 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
503 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
504 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
505 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
506 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
507 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
508 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
509
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
510 bwipe!
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
511 diffoff
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
512 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
513
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
514 func Test_termguicolors()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21091
diff changeset
515 CheckOption termguicolors
18742
e9b2ade1adbd patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents: 18574
diff changeset
516 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
517 " 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
518 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
519 return
1720b96e53b6 patch 8.0.1601: highlight test fails on Win32
Christian Brabandt <cb@256bit.org>
parents: 13452
diff changeset
520 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
521
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
522 " 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
523 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
524 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
525 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
526 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
527 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
528 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
529 endfunc
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
530
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
531 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
532 CheckScreendump
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
533
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
534 call writefile([
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
535 \ 'set cul rnu',
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
536 \ '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
537 \ ], 'Xtest_cursorline_yank')
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
538 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
539 call TermWait(buf)
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
540 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
541 call TermWait(buf)
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
542 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
543
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
544 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
545
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
546 " clean up
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
547 call StopVimInTerminal(buf)
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
548 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
549 endfunc
15991
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
550
18023
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
551 " 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
552 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
553 new
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
554 only!
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
555 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
556 redraw
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
557 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
558 set cursorline
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
559 redraw
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
560 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
561 normal yyP
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 " 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
564 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
565 " 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
566 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
567 set nocursorline
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
568 bwipe!
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
569 endfunc
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
570
15991
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
571 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
572 CheckScreendump
15991
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
573
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
574 call writefile([
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
575 \ 'set cul',
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
576 \ '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
577 \ ], '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
578 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
579 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
580 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
581
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
582 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
583
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
584 " clean up
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
585 call StopVimInTerminal(buf)
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
586 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
587 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
588
16788
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
589 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
590 CheckScreendump
19273
a4b65930a0dc patch 8.2.0195: some tests fail when run in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 19255
diff changeset
591 " 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
592 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
593
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
594 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
595 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
596 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
597 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
598 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
599 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
600 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
601 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
602 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
603 /here
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
604 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
605 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
606 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
607 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
608 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
609 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
610
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
611 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
612
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
613 " 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
614 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
615 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
616 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
617 endfunc
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
618
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
619 func Test_wincolor_listchars()
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
620 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
621 CheckFeature conceal
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
622
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
623 let lines =<< trim END
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
624 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
625 set wincolor=Todo
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
626 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
627 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
628 call matchadd('Conceal', 'text')
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
629 normal 2G5zl
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
630 END
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
631 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
632 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
633
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
634 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
635
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
636 " clean up
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
637 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
638 call StopVimInTerminal(buf)
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
639 call delete('Xtest_wincolorlcs')
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
640 endfunc
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
641
18156
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
642 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
643 CheckScreendump
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
644
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
645 " 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
646 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
647 split
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
648 edit X
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
649 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
650 set nomodified
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
651 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
652 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
653 wincmd w
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
654 buf X
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
655 END
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
656 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
657 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
658 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
659 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
660 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
661
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
662 " clean up
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
663 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
664 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
665 endfunc
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
666
22280
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
667 func Test_colorcolumn_bri()
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
668 CheckScreendump
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
669
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
670 " 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
671 let lines =<< trim END
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
672 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
673 END
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
674 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
675 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
676 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
677 call TermWait(buf)
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
678 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
679
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
680 " clean up
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
681 call StopVimInTerminal(buf)
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
682 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
683 endfunc
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
684
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
685 func Test_colorcolumn_sbr()
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
686 CheckScreendump
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
687
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
688 " 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
689 let lines =<< trim END
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
690 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
691 END
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
692 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
693 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
694 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
695 call TermWait(buf)
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
696 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
697
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
698 " clean up
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
699 call StopVimInTerminal(buf)
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
700 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
701 endfunc
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
702
16613
850e13b71c1c patch 8.1.1309: test for Normal highlight fails on MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 16611
diff changeset
703 " 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
704 " 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
705 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
706 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
707 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
708 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
709 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
710 " 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
711 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
712 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
713 " 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
714 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
715 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
716 " 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
717 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
718 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
719 endfunc
17214
079ce74ecaa5 patch 8.1.1606: on a narrow screen ":hi" output is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
720
19273
a4b65930a0dc patch 8.2.0195: some tests fail when run in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 19255
diff changeset
721 " 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
722 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
723 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
724 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
725 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
726 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
727 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
728 endfunc
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
729
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
730 " 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
731 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
732 if has('gui_running')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
733 " 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
734 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
735 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
736 call assert_fails('hi Xcomment ctermfg=ul', 'E453:')
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
737 endif
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
738
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
739 " 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
740 " test.
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
741 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
742 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
743 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
744 let &t_fo = ""
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
745 endfunc
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
746
21052
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
747 " Test for 'highlight' option
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
748 func Test_highlight_opt()
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
749 let save_hl = &highlight
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
750 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
751 set highlight=f\ r
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
752 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
753 set highlight=fb
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
754 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
755 set highlight=fi
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
756 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
757 set highlight=f-
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
758 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
759 set highlight=fr
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
760 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
761 set highlight=fs
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
762 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
763 set highlight=fu
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
764 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
765 set highlight=fc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
766 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
767 set highlight=ft
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
768 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
769 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
770 set highlight=f:$#
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
771 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
772 let &highlight = save_hl
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
773 endfunc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
774
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
775 " 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
776 func Test_highlight_User()
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
777 CheckNotGui
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
778 hi User1 ctermfg=12
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
779 redraw!
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
780 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
781 hi clear
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
782 endfunc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
783
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
784 " 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
785 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
786 CheckCanRunGui
f07068ed0d3d patch 8.2.2375: test for RGB color skipped in the terminal
Bram Moolenaar <Bram@vim.org>
parents: 22446
diff changeset
787 gui -f
21052
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
788 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
789 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
790 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
791 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
792 hi clear
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
793 endfunc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
794
21091
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
795 " 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
796 func Test_highlight_default()
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
797 highlight MySearch ctermfg=7
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
798 highlight default MySearch ctermfg=5
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
799 let hlSearch = HighlightArgs('MySearch')
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
800 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
801
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
802 highlight default QFName ctermfg=3
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
803 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
804 hi clear
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
805 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
806
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
807 " 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
808 func Test_highlight_ctermul()
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
809 CheckNotGui
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
810 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
811 highlight Normal ctermul=3
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
812 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
813 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
814 highlight Normal ctermul=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
815 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
816
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
817 " 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
818 func Test_highlight_start_stop()
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
819 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
820 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
821 hi HlGrp1 start=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
822 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
823 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
824 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
825 hi HlGrp2 stop=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
826 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
827 hi clear
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
828 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
829
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
830 " 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
831 func Test_highlight_term_attr()
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
832 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
833 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
834 hi HlGrp3 term=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
835 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
836 hi clear
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
837 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
838
22308
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
839 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
840 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
841 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
842
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
843 " 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
844 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
845 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
846 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
847
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
848 " 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
849 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
850 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
851
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
852 " 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
853 hi clear aaa
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
854 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
855
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
856 " 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
857 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
858 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
859 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
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 " 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
864 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
865 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
866 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
867 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
868
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
869 " 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
870 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
871 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
872 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
873 hi clear 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(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
875 endfunc
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
876
22312
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
877 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
878 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
879 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
880 endfun
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
881
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
882 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
883 " 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
884 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
885 endfunc
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
886
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
887 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
888 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
889 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
890 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
891
22316
d275371fd1e7 patch 8.2.1707: small inconsitency in highlight test
Bram Moolenaar <Bram@vim.org>
parents: 22312
diff changeset
892 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
893 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
894 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
895
22316
d275371fd1e7 patch 8.2.1707: small inconsitency in highlight test
Bram Moolenaar <Bram@vim.org>
parents: 22312
diff changeset
896 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
897 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
898 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
899
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
900 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
901 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
902 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
903
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
904 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
905 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
906 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
907 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
908 endfunc
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
909
22308
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
910 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
911 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
912 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
913
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
914 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
915 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
916
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
917 " Test colorscheme
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
918 hi clear
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
919 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
920 syntax reset
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
921 endif
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
922 let g:colors_name = 'test'
22308
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
923 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
924 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
925
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
926 " 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
927 colorscheme default
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
928 " 'default' should work no matter if highlight group was cleared
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
929 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
930 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
931 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
932 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
933 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
934 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
935 hi clear
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
936 endfunc
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
937
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
938 func Test_colornames_assignment_and_lookup()
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
939 " 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
940 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
941 highlight Normal guifg='a redish white'
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
942 highlight clear
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
943 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
944
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
945 func Test_colornames_default_list()
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
946 " Ensure default lists are loaded automatically and can be used for all gui fields.
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
947 highlight Normal guifg='rebecca purple' guibg='rebecca purple' guisp='rebecca purple'
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
948 highlight clear
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
949 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
950
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
951 func Test_colornames_overwrite_default()
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
952 " 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
953 " 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
954 colorscheme default
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
955 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
956 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
957 let v:colornames['rebecca purple'] = '#550099'
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
958 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
959 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
960 highlight clear
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
961 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
962
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
963 func Test_colornames_assignment_and_unassignment()
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
964 " 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
965 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
966
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
967 " 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
968 let v:colornames['x1'] = '#111111'
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
969 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
970 unlet v:colornames['x1']
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
971 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
972 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
973
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
974 " Test for the hlget() function
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
975 func Test_hlget()
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
976 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
977 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
978 call assert_equal([], hlget('SomeHLGroup'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
979 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
980 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
981 highlight clear MyHLGroup
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
982 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
983 highlight link MyHLGroup IncSearch
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
984 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
985 highlight clear MyHLGroup
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
986 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
987 call assert_equal([], hlget(""))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
988 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
989 call CheckLegacyAndVim9Success(lines)
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
990
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
991 " Test for resolving highlight group links
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
992 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
993 highlight hlgA term=bold
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
994 VAR hlgAid = hlID('hlgA')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
995 highlight link hlgB hlgA
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
996 VAR hlgBid = hlID('hlgB')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
997 highlight link hlgC hlgB
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
998 VAR hlgCid = hlID('hlgC')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
999 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
1000 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
1001 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
1002 \ 'term': {'bold': v:true}}], hlget('hlgA'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1003 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
1004 \ 'linksto': 'hlgA'}], hlget('hlgB'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1005 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
1006 \ 'linksto': 'hlgB'}], hlget('hlgC'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1007 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
1008 \ '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
1009 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
1010 \ 'linksto': 'hlgA'}], hlget('hlgB', 0))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1011 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
1012 \ 'linksto': 'hlgB'}], hlget('hlgC', v:false))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1013 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
1014 \ '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
1015 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
1016 \ '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
1017 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
1018 \ '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
1019 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1020 call CheckLegacyAndVim9Success(lines)
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1021
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1022 call assert_fails('call hlget([])', 'E1174:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1023 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
1024 endfunc
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1025
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1026 " Test for the hlset() function
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1027 func Test_hlset()
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1028 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1029 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
1030 call assert_equal(0, hlset([]))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1031 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
1032 call hlset(hlget())
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1033 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
1034 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
1035 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
1036 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
1037 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
1038 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
1039 call hlset([{'name': 'NewHLGroup', 'linksto': 'Search'}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1040 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
1041 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
1042 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
1043 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
1044 \ 'E745:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1045 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
1046 \ 'E715:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1047 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
1048 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1049 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
1050 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1051 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
1052 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1053 if has('gui')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1054 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
1055 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1056 endif
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1057 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
1058 \ 'E715:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1059 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
1060 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1061 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
1062 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1063 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
1064 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1065 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
1066 \ 'E928:')
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': 'NewHLGroup', 'start': []}])",
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1068 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1069 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
1070 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1071 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
1072 \ 'E715:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1073 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
1074 highlight clear NewHLGroup
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1075 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1076 call CheckLegacyAndVim9Success(lines)
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1077
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1078 " 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
1079 " group.
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1080 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1081 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
1082 VAR id = hlID('myhlg1')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1083 call hlset([{'name': 'myhlg1', 'term': {}}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1084 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
1085 \ '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
1086 \ hlget('myhlg1'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1087 call hlset([{'name': 'myhlg1', 'cterm': {}}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1088 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
1089 \ 'gui': {'standout': v:true}}], hlget('myhlg1'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1090 call hlset([{'name': 'myhlg1', 'gui': {}}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1091 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
1092 \ hlget('myhlg1'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1093 highlight clear myhlg1
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1094 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1095 call CheckLegacyAndVim9Success(lines)
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1096
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1097 " 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
1098 " highlight group
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1099 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1100 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
1101 \ '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
1102 \ 'standout': v:true, 'nocombine': v:true}
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1103 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
1104 VAR id2 = hlID('myhlg2')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1105 VAR output =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1106 myhlg2 xxx term=bold,standout,underline,undercurl,italic,reverse,nocombine,strikethrough
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1107 cterm=bold,standout,underline,undercurl,italic,reverse,nocombine,strikethrough
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1108 gui=bold,standout,underline,undercurl,italic,reverse,nocombine,strikethrough
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1109 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1110 call assert_equal(output, execute('highlight myhlg2')->split("\n"))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1111 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
1112 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1113 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1114 call CheckLegacyAndVim9Success(lines)
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1115
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1116 " 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
1117 " highlight group
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1118 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1119 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
1120 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
1121 VAR id2 = hlID('myhlg2')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1122 VAR output =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1123 myhlg2 xxx term=underline,strikethrough cterm=underline,strikethrough
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1124 gui=underline,strikethrough
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1125 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1126 call assert_equal(output, execute('highlight myhlg2')->split("\n"))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1127 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
1128 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
1129 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1130 END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1131 call CheckLegacyAndVim9Success(lines)
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1132 endfunc
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1133
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
1134 " vim: shiftwidth=2 sts=2 expandtab