annotate src/testdir/test_highlight.vim @ 32588:25f4c1d11344 v9.0.1626

patch 9.0.1626: Visual area not shown when using 'showbreak' Commit: https://github.com/vim/vim/commit/f578ca2c8f36b61ac3301fe8b59a8473c964cdc2 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 10 19:40:30 2023 +0100 patch 9.0.1626: Visual area not shown when using 'showbreak' Problem: Visual area not shown when using 'showbreak' and start of line is not visible. (Jaehwang Jung) Solution: Adjust "fromcol" for the space taken by 'showbreak'. (closes #12514)
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Jun 2023 20:45:06 +0200
parents e7ab58f57ea3
children 448aef880252
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
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
7 import './vim9.vim' as v9
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
8
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
9 func ClearDict(d)
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
10 for k in keys(a:d)
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
11 call remove(a:d, k)
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
12 endfor
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
13 endfunc
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
14
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 func Test_highlight()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " basic test if ":highlight" doesn't crash
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 highlight
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 hi Search
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " test setting colors.
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " test clearing one color and all doesn't generate error or warning
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 silent! hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 silent! hi Group2 term= cterm=
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 hi Group3 term=underline cterm=bold
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 let res = split(execute("hi NewGroup"), "\n")[0]
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " filter ctermfg and ctermbg, the numbers depend on the terminal
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let res = substitute(res, 'ctermfg=\d*', 'ctermfg=2', '')
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let res = substitute(res, 'ctermbg=\d*', 'ctermbg=3', '')
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal("NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 \ res)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal("Group3 xxx term=underline cterm=bold",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ split(execute("hi Group3"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 hi clear NewGroup
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal("NewGroup xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 \ split(execute("hi NewGroup"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 hi Group2 NONE
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 hi clear
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal("Group3 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 \ split(execute("hi Group3"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call assert_fails("hi Crash term='asdf", "E475:")
31992
a509eb37a813 patch 9.0.1328: error when using "none" for GUI color is confusing
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
49
a509eb37a813 patch 9.0.1328: error when using "none" for GUI color is confusing
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
50 if has('gui_running')
a509eb37a813 patch 9.0.1328: error when using "none" for GUI color is confusing
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
51 call assert_fails('hi NotUsed guibg=none', 'E1361:')
a509eb37a813 patch 9.0.1328: error when using "none" for GUI color is confusing
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
52 endif
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
54
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
55 func 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
56 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
57 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
58
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
59 func IsColorable()
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
60 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
61 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
62
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
63 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
64 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
65 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
66 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
67 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
68 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
69 else
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
70 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
71 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
72 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
73 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
74 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
75
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
76 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
77 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
78 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
79
97f0c74976c6 patch 8.0.1169: highlignting one char too many with 'list' and 'cul'
Christian Brabandt <cb@256bit.org>
parents: 12580
diff changeset
80 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
81
97f0c74976c6 patch 8.0.1169: highlignting one char too many with 'list' and 'cul'
Christian Brabandt <cb@256bit.org>
parents: 12580
diff changeset
82 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
83 let &lcs = save_lcs
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13454
diff changeset
84 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
85
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
86 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
87 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
88
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
89 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
90 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
91 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
92
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
93 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
94 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
95 " ^^^^ ^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
96 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
97 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
98 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
99 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
100 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
101
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
102 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
103
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
104 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
105 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
106
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
107 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
108 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
109 " ^^^^ 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
110 " ^ '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
111 " ^^^^^ underline
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
121 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
122 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
123 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
124
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
125 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
126 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
127 " ^^^^ 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
128 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
129 " ^^^^^ 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
130 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
131 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
132 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
133 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
134 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
135 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
136 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
137 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
138 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
139 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
140
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
141 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
142 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
143 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
144
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
145 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
146 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
147
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
148 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
149 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
150 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
151
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
152 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
153 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
154 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
155
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
156 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
157 " 'abcd |abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
158 " ^^^^ ^^^^^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
159 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
160 " ^ 'VertSplit' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
161 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
162 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
163 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
164 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
165 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
166 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
167
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
168 setlocal cursorline
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 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
171 " 'abcd |abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
172 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
173 " ^ '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
174 " ^ 'VertSplit' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
175 " ^^^^^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
176
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
177 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
178 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
179
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
180 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
181 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
182
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
183 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
184 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
185 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
186 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
187 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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
196 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
197 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
198 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
199
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
200 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
201 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
202
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
203 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
204 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
205 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
206 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
207 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
208 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
209 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
210 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
211 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
212 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
213 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
214 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
215 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
216
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
217 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
218 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
219 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
220
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
221 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
222 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
223
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
224 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
225
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
226 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
227 setlocal rightleft
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
228 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
229 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
230 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
231
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
232 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
233
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
234 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
235 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
236
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
237 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
238 " ' dcba'
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
239 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
240 " ^ '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
241 " ^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
242 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
243 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
244 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
245 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
246 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
247 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
248 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
249 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
250
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
251 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
252 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
253 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
254
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
255 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
256 " ' dcba'
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
257 " ^^^^ 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
258 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
259 " ^^^^^ 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
260 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
261 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
262 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
263 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
264 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
265 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
266 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
267 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
268 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
269 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
270
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
271 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
272 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
273 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
274
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
275 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
276 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
277
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
278 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
279 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
280 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
281
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
282 setlocal wrap
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
283 normal! gg$
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
284 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
285 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
286
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
287 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
288 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
289
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
290 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
291 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
292 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
293 " ^ '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
294 " ^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
295 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
296 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
297 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
298 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
299 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
300 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
301 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
302 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
303
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
304 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
305 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
306 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
307
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
308 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
309 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
310 " ^^^^ 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
311 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
312 " ^^^^^ 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
313 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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 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
322 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
323
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
324 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
325 normal! gg$
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
326 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
327 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
328
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
329 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
330 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
331
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
332 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
333 " 'aaabcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
334 " ^^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
335 " ^ '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
336 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
337 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
338 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
339 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
340 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
341 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
342 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
343 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
344 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
345
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
346 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
347 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
348 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
349
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
350 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
351 " 'aaabcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
352 " ^^^^^^ 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
353 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
354 " ^^^ 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
355 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
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
365
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
366 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
367 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
368 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
369
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
370 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
371 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
372
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
373 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
374
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
375 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
376 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
377 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
378
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
379 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
380 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
381 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
382 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
383
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
384 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
385 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
386
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
387 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
388 " '>>abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
389 " ^^ sign
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
390 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
391 " ^ '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
392 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
393 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
394 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
395 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
396 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
397 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
398 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
399 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
400 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
401
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
402 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
403 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
404 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
405
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
406 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
407 " '>>abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
408 " ^^ sign
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
409 " ^^^^ 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
410 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
411 " ^^^ 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
412 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
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421 endif
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 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
424 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
425 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
426 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
427
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
428 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
429 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
430
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
431 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
432
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
433 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
434 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
435 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
436 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
437 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
438 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
439 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
440
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
441 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
442 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
443
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
444 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
445 " ' >bcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
446 " ^^^ 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
447 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
448 " ^ '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
449 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
450 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
451 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
452 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
453 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
454 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
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
464 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
465 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
466 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
467
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
468 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
469 " ' >bcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
470 " ^^^ 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
471 " ^^^ 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
472 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
473 " ^^^ 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
474 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
475 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
476 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
477 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
478 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
479 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
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
489
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
490 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
491 set showbreak=
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18156
diff changeset
492 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
493 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
494 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
495
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
496 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
497 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
498 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
499 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
500
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
501 diffthis
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
502 botright new
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
503 diffthis
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
504
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
505 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
506 " ' abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
507 " ^^ sign
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
508 " ^^^^ ^^^ 'DiffAdd' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
509 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
510 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
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 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
519
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
520 bwipe!
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
521 diffoff
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
522 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
523
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 func Test_termguicolors()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21091
diff changeset
525 CheckOption termguicolors
18742
e9b2ade1adbd patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents: 18574
diff changeset
526 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
527 " 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
528 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
529 return
1720b96e53b6 patch 8.0.1601: highlight test fails on Win32
Christian Brabandt <cb@256bit.org>
parents: 13452
diff changeset
530 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
531
9b09f6e470e0 patch 8.0.1600: crash when setting t_Co to zero when 'termguicolors' is set
Christian Brabandt <cb@256bit.org>
parents: 12582
diff changeset
532 " 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
533 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
534 redraw
9b09f6e470e0 patch 8.0.1600: crash when setting t_Co to zero when 'termguicolors' is set
Christian Brabandt <cb@256bit.org>
parents: 12582
diff changeset
535 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
536 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
537 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
538 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
539 endfunc
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
540
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
541 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
542 CheckScreendump
15683
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 writefile([
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
545 \ 'set cul rnu',
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
546 \ 'call setline(1, ["","1","2","3",""])',
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
547 \ ], 'Xtest_cursorline_yank', 'D')
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
548 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
549 call TermWait(buf)
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
550 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
551 call TermWait(buf)
15683
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
552 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
553
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
554 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
555
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
556 " clean up
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
557 call StopVimInTerminal(buf)
adc6442118b8 patch 8.1.0849: cursorline highlight is not always updated
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
558 endfunc
15991
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
559
18023
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
560 " 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
561 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
562 new
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
563 only!
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
564 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
565 redraw
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
566 let 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
567 set cursorline
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
568 redraw
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
569 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
570 normal yyP
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
571 redraw
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
572 " 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
573 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
574 " 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
575 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
576 set nocursorline
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
577 bwipe!
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
578 endfunc
fd75825d06db patch 8.1.2007: no test for what 8.1.1926 fixes
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
579
15991
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
580 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
581 CheckScreendump
15991
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
582
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
583 call writefile([
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
584 \ 'set cul',
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
585 \ 'call setline(1, repeat(["abc"], 50))',
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
586 \ ], 'Xtest_cursorline_with_visualmode', 'D')
15991
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
587 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
588 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
589 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
590
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
591 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
592
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
593 " clean up
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
594 call StopVimInTerminal(buf)
f362d695bcf9 patch 8.1.1001: Visual area not correct when using 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15683
diff changeset
595 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
596
28269
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
597 func Test_cursorcolumn_insert_on_tab()
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
598 CheckScreendump
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
599
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
600 let lines =<< trim END
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
601 call setline(1, ['123456789', "a\tb"])
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
602 set cursorcolumn
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
603 call cursor(2, 2)
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
604 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
605 call writefile(lines, 'Xcuc_insert_on_tab', 'D')
28269
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
606
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
607 let buf = RunVimInTerminal('-S Xcuc_insert_on_tab', #{rows: 8})
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
608 call TermWait(buf)
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
609 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_1', {})
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
610
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
611 call term_sendkeys(buf, 'i')
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
612 call TermWait(buf)
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
613 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
614
28363
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
615 call term_sendkeys(buf, "\<C-O>")
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
616 call TermWait(buf)
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
617 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_3', {})
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
618
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
619 call term_sendkeys(buf, 'i')
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
620 call TermWait(buf)
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
621 call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
a9a56b567709 patch 8.2.4707: redrawing could be a bit more efficient
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
622
28269
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
623 call StopVimInTerminal(buf)
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
624 endfunc
20b28fbf7f03 patch 8.2.4660: cursorcolumn is sometimes not correct
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
625
28224
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
626 func Test_cursorcolumn_callback()
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
627 CheckScreendump
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
628 CheckFeature timers
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
629
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
630 let lines =<< trim END
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
631 call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
632 set cursorcolumn
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
633 call cursor(4, 5)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
634
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
635 func Func(timer)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
636 call cursor(1, 1)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
637 endfunc
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
638
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
639 call timer_start(300, 'Func')
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
640 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
641 call writefile(lines, 'Xcuc_timer', 'D')
28224
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
642
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
643 let buf = RunVimInTerminal('-S Xcuc_timer', #{rows: 8})
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
644 call TermWait(buf, 310)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
645 call VerifyScreenDump(buf, 'Test_cursorcolumn_callback_1', {})
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
646
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
647 call StopVimInTerminal(buf)
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
648 endfunc
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
649
16788
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
650 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
651 CheckScreendump
19273
a4b65930a0dc patch 8.2.0195: some tests fail when run in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 19255
diff changeset
652 " 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
653 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
654
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
655 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
656 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
657 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
658 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
659 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
660 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
661 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
662 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
663 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
664 /here
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
665 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
666 call writefile(lines, 'Xtest_wincolor', 'D')
16788
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
667 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
668 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
669 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
670 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
671
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
672 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
673
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
674 " 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
675 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
676 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
677 endfunc
f7268ec2c889 patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents: 16613
diff changeset
678
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
679 func Test_wincolor_listchars()
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
680 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
681 CheckFeature conceal
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
682
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
683 let lines =<< trim END
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
684 call setline(1, ["one","\t\tsome random text enough long to show 'extends' and 'precedes' includingnbsps, preceding tabs and trailing spaces ","three"])
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
685 set wincolor=Todo
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
686 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
687 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
688 call matchadd('Conceal', 'text')
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
689 normal 2G5zl
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
690 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
691 call writefile(lines, 'Xtest_wincolorlcs', 'D')
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
692 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
693
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
694 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
695
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
696 " clean up
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
697 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
698 call StopVimInTerminal(buf)
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
699 endfunc
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18742
diff changeset
700
18156
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
701 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
702 CheckScreendump
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
703
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
704 " 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
705 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
706 split
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
707 edit X
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
708 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
709 set nomodified
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
710 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
711 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
712 wincmd w
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
713 buf X
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
714 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
715 call writefile(lines, 'Xtest_colorcolumn', 'D')
18156
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
716 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
717 call term_sendkeys(buf, ":\<CR>")
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
718 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
719
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
720 " clean up
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
721 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
722 endfunc
c81370b3ede4 patch 8.1.2073: when editing a buffer 'colorcolumn' may not work
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
723
22280
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
724 func Test_colorcolumn_bri()
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
725 CheckScreendump
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
726
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
727 " 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
728 let lines =<< trim END
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
729 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
730 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
731 call writefile(lines, 'Xtest_colorcolumn_bri', 'D')
22280
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
732 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
733 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
734 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
735
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
736 " clean up
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
737 call StopVimInTerminal(buf)
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
738 endfunc
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
739
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
740 func Test_colorcolumn_sbr()
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
741 CheckScreendump
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
742
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
743 " 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
744 let lines =<< trim END
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
745 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
746 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29328
diff changeset
747 call writefile(lines, 'Xtest_colorcolumn_srb', 'D')
22280
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
748 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
749 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
750 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
751
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
752 " clean up
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
753 call StopVimInTerminal(buf)
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
754 endfunc
47ebfc274e3f patch 8.2.1689: 'colorcolumn' doesn't show in indent
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
755
32588
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
756 func Test_visual_sbr()
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
757 CheckScreendump
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
758
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
759 " check Visual highlight when 'showbreak' is set
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
760 let lines =<< trim END
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
761 set showbreak=>
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
762 call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.')
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
763 exe "normal! z1\<CR>"
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
764 END
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
765 call writefile(lines, 'Xtest_visual_sbr', 'D')
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
766 let buf = RunVimInTerminal('-S Xtest_visual_sbr', {'rows': 6,'columns': 60})
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
767
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
768 call term_sendkeys(buf, "v$")
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
769 call VerifyScreenDump(buf, 'Test_visual_sbr_1', {})
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
770
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
771 " clean up
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
772 call term_sendkeys(buf, "\<Esc>")
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
773 call StopVimInTerminal(buf)
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
774 endfunc
25f4c1d11344 patch 9.0.1626: Visual area not shown when using 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
775
16613
850e13b71c1c patch 8.1.1309: test for Normal highlight fails on MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 16611
diff changeset
776 " 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
777 " 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
778 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
779 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
780 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
781 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
782 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
783 " 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
784 call assert_match('hi Normal\s*font=Monospace 10', hlNormal)
28303
9849df834f1d patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 28269
diff changeset
785 elseif has('gui_motif')
17239
fceb0977275a patch 8.1.1619: tests are not run with GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 17214
diff changeset
786 " 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
787 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
788 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
789 " 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
790 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
791 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
792 endfunc
17214
079ce74ecaa5 patch 8.1.1606: on a narrow screen ":hi" output is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
793
19273
a4b65930a0dc patch 8.2.0195: some tests fail when run in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 19255
diff changeset
794 " 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
795 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
796 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
797 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
798 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
799 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
800 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
801 endfunc
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
802
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
803 " 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
804 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
805 if has('gui_running')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
806 " 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
807 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
808 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
809 call assert_fails('hi Xcomment ctermfg=ul', 'E453:')
26454
9998318235cd patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents: 26274
diff changeset
810 call assert_fails('hi ' .. repeat('a', 201) .. ' ctermfg=black', 'E1249:')
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
811 endif
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
812
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
813 " 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
814 " test.
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
815 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
816 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
817 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
818 let &t_fo = ""
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
819 endfunc
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
820
21052
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
821 " Test for 'highlight' option
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
822 func Test_highlight_opt()
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
823 let save_hl = &highlight
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
824 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
825 set highlight=f\ r
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
826 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
827 set highlight=fb
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
828 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
829 set highlight=fi
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
830 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
831 set highlight=f-
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
832 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
833 set highlight=fr
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
834 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
835 set highlight=fs
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
836 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
837 set highlight=fu
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
838 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
839 set highlight=fc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
840 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
841 set highlight=ft
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
842 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
843 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
844 set highlight=f:$#
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
845 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
846 let &highlight = save_hl
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
847 endfunc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
848
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
849 " 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
850 func Test_highlight_User()
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
851 CheckNotGui
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
852 hi User1 ctermfg=12
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
853 redraw!
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
854 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
855 hi clear
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
856 endfunc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
857
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
858 " 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
859 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
860 CheckCanRunGui
f07068ed0d3d patch 8.2.2375: test for RGB color skipped in the terminal
Bram Moolenaar <Bram@vim.org>
parents: 22446
diff changeset
861 gui -f
21052
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
862 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
863 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
864 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
865 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
866 hi clear
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
867 endfunc
f3c72001de63 patch 8.2.1077: no enough test coverage for highlighting
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
868
21091
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
869 " 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
870 func Test_highlight_default()
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
871 highlight MySearch ctermfg=7
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
872 highlight default MySearch ctermfg=5
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
873 let hlSearch = HighlightArgs('MySearch')
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
874 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
875
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
876 highlight default QFName ctermfg=3
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
877 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
878 hi clear
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
879 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
880
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
881 " 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
882 func Test_highlight_ctermul()
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
883 CheckNotGui
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
884 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
885 highlight Normal ctermul=3
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
886 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
887 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
888 highlight Normal ctermul=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
889 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
890
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
891 " 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
892 func Test_highlight_start_stop()
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
893 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
894 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
895 hi HlGrp1 start=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
896 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
897 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
898 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
899 hi HlGrp2 stop=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
900 call assert_notmatch("stop=", HighlightArgs('HlGrp2'))
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 31992
diff changeset
901 set t_xy=^[foo;
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 31992
diff changeset
902 set t_xz=^[bar;
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 31992
diff changeset
903 hi HlGrp3 start=t_xy stop=t_xz
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 31992
diff changeset
904 let d = hlget('HlGrp3')
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 31992
diff changeset
905 call assert_equal('^[foo;', d[0].start)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 31992
diff changeset
906 call assert_equal('^[bar;', d[0].stop)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 31992
diff changeset
907 set t_xy= t_xz=
21091
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
908 hi clear
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
909 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
910
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
911 " 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
912 func Test_highlight_term_attr()
29328
60977de70684 patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents: 28363
diff changeset
913 hi HlGrp3 term=bold,underline,undercurl,underdouble,underdotted,underdashed,strikethrough,reverse,italic,standout
60977de70684 patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents: 28363
diff changeset
914 call assert_equal('hi HlGrp3 term=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough', HighlightArgs('HlGrp3'))
21091
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
915 hi HlGrp3 term=NONE
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
916 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
917 hi clear
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
918 endfunc
f6eb0c468ae4 patch 8.2.1097: highlight code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21052
diff changeset
919
22308
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
920 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
921 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
922 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
923
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
924 " 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
925 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
926 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
927 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
928
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
929 " 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
930 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
931 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
932
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
933 " 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
934 hi clear aaa
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
935 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
936
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
937 " 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
938 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
939 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
940 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
941 hi clear aaa
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
942 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
943
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
944 " 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
945 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
946 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
947 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
948 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
949
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
950 " 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
951 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
952 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
953 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
954 hi clear aaa
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
955 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
956 endfunc
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
957
22312
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
958 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
959 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
960 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
961 endfun
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
962
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
963 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
964 " 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
965 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
966 endfunc
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
967
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
968 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
969 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
970 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
971 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
972
22316
d275371fd1e7 patch 8.2.1707: small inconsitency in highlight test
Bram Moolenaar <Bram@vim.org>
parents: 22312
diff changeset
973 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
974 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
975 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
976
22316
d275371fd1e7 patch 8.2.1707: small inconsitency in highlight test
Bram Moolenaar <Bram@vim.org>
parents: 22312
diff changeset
977 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
978 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
979 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
980
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
981 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
982 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
983 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
984
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
985 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
986 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
987 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
988 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
989 endfunc
e06ba60fbbd8 patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents: 22308
diff changeset
990
22308
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
991 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
992 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
993 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
994
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
995 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
996 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
997
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
998 " Test colorscheme
26907
6f43253463cc patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 26454
diff changeset
999 call assert_equal("\ndefault", execute('colorscheme'))
22288
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1000 hi clear
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1001 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
1002 syntax reset
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1003 endif
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1004 let g:colors_name = 'test'
26907
6f43253463cc patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 26454
diff changeset
1005 call assert_equal("\ntest", execute('colorscheme'))
22308
19e0784ef769 patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents: 22288
diff changeset
1006 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
1007 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
1008
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1009 " 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
1010 colorscheme default
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1011 " 'default' should work no matter if highlight group was cleared
26907
6f43253463cc patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 26454
diff changeset
1012 call assert_equal("\ndefault", execute('colorscheme'))
22288
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1013 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
1014 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
1015 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
1016 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
1017 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
1018 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
1019 hi clear
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1020 endfunc
a9ff3e0d6d54 patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents: 22280
diff changeset
1021
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1022 func Test_colornames_assignment_and_lookup()
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1023 CheckAnyOf Feature:gui_running Feature:termguicolors
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1024
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1025 " 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
1026 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
1027 highlight Normal guifg='a redish white'
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1028 highlight clear
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1029 call ClearDict(v:colornames)
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1030 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1031
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1032 func Test_colornames_default_list()
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1033 CheckAnyOf Feature:gui_running Feature:termguicolors
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1034
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1035 " Ensure default lists are loaded automatically and can be used for all gui fields.
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1036 call assert_equal(0, len(v:colornames))
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1037 highlight Normal guifg='rebecca purple' guibg='rebecca purple' guisp='rebecca purple'
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1038 call assert_notequal(0, len(v:colornames))
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1039 echo v:colornames['rebecca purple']
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1040 highlight clear
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1041 call ClearDict(v:colornames)
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1042 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1043
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1044 func Test_colornames_overwrite_default()
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1045 CheckAnyOf Feature:gui_running Feature:termguicolors
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1046
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1047 " 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
1048 " 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
1049 colorscheme default
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1050 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
1051 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
1052 let v:colornames['rebecca purple'] = '#550099'
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1053 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
1054 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
1055 highlight clear
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1056 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1058 func Test_colornames_assignment_and_unassignment()
26115
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1059 " No feature check is needed for this test because the v:colornames dict
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1060 " always exists with +eval. The feature checks are only required for
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1061 " commands that do color lookup.
bb87ce13e7d6 patch 8.2.3590: test for v:colornames sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26089
diff changeset
1062
26057
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1063 " 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
1064 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
1065
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1066 " 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
1067 let v:colornames['x1'] = '#111111'
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1068 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
1069 unlet v:colornames['x1']
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1070 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
1071 endfunc
92c424550367 patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents: 23667
diff changeset
1072
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1073 " Test for the hlget() function
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1074 func Test_hlget()
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1075 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1076 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
1077 call assert_equal([], hlget('SomeHLGroup'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1078 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
1079 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
1080 highlight clear MyHLGroup
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1081 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
1082 highlight link MyHLGroup IncSearch
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1083 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
1084 highlight clear MyHLGroup
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1085 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
1086 call assert_equal([], hlget(""))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1087 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1088 call v9.CheckLegacyAndVim9Success(lines)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1090 " Test for resolving highlight group links
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1091 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1092 highlight hlgA term=bold
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1093 VAR hlgAid = hlID('hlgA')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1094 highlight link hlgB hlgA
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1095 VAR hlgBid = hlID('hlgB')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1096 highlight link hlgC hlgB
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1097 VAR hlgCid = hlID('hlgC')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1098 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
1099 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
1100 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
1101 \ 'term': {'bold': v:true}}], hlget('hlgA'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1102 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
1103 \ 'linksto': 'hlgA'}], hlget('hlgB'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1104 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
1105 \ 'linksto': 'hlgB'}], hlget('hlgC'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1106 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
1107 \ '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
1108 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
1109 \ 'linksto': 'hlgA'}], hlget('hlgB', 0))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1110 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
1111 \ 'linksto': 'hlgB'}], hlget('hlgC', v:false))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1112 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
1113 \ '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
1114 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
1115 \ '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
1116 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
1117 \ '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
1118 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1119 call v9.CheckLegacyAndVim9Success(lines)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1120
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1121 call assert_fails('call hlget([])', 'E1174:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1122 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
1123 endfunc
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1124
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1125 " Test for the hlset() function
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1126 func Test_hlset()
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1127 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1128 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
1129 call assert_equal(0, hlset([]))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1130 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
1131 call hlset(hlget())
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1132 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
1133 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
1134 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
1135 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
1136 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
1137 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
1138 call hlset([{'name': 'NewHLGroup', 'linksto': 'Search'}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1139 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
1140 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
1141 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
1142 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
1143 \ 'E745:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1144 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
1145 \ 'E715:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1146 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
1147 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1148 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
1149 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1150 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
1151 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1152 if has('gui')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1153 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
1154 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1155 endif
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1156 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
1157 \ 'E715:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1158 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
1159 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1160 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
1161 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1162 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
1163 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1164 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
1165 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1166 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
1167 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1168 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
1169 \ 'E928:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1170 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
1171 \ 'E715:')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1172 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
1173 highlight clear NewHLGroup
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1174 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1175 call v9.CheckLegacyAndVim9Success(lines)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1176
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1177 " 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
1178 " group.
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1179 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1180 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
1181 VAR id = hlID('myhlg1')
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1182 call hlset([{'name': 'myhlg1', 'term': {}}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1183 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
1184 \ '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
1185 \ hlget('myhlg1'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1186 call hlset([{'name': 'myhlg1', 'cterm': {}}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1187 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
1188 \ 'gui': {'standout': v:true}}], hlget('myhlg1'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1189 call hlset([{'name': 'myhlg1', 'gui': {}}])
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1190 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
1191 \ hlget('myhlg1'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1192 highlight clear myhlg1
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1193 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1194 call v9.CheckLegacyAndVim9Success(lines)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1195
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1196 " 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
1197 " highlight group
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1198 let lines =<< trim END
29328
60977de70684 patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents: 28363
diff changeset
1199 VAR attr = {'bold': v:true, 'underline': v:true,
60977de70684 patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents: 28363
diff changeset
1200 \ 'undercurl': v:true, 'underdouble': v:true,
60977de70684 patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents: 28363
diff changeset
1201 \ 'underdotted': v:true, 'underdashed': v:true,
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1202 \ '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
1203 \ 'standout': v:true, 'nocombine': v:true}
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1204 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
1205 VAR id2 = hlID('myhlg2')
29328
60977de70684 patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents: 28363
diff changeset
1206 VAR expected = "myhlg2 xxx term=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough cterm=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough gui=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough"
26145
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1207 VAR output = execute('highlight myhlg2')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1208 LET output = output->split("\n")->join()->substitute('\s\+', ' ', 'g')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1209 call assert_equal(expected, output)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1210 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
1211 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1212 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1213 call v9.CheckLegacyAndVim9Success(lines)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1214
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1215 " 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
1216 " highlight group
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1217 let lines =<< trim END
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1218 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
1219 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
1220 VAR id2 = hlID('myhlg2')
26145
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1221 VAR expected = "myhlg2 xxx term=underline,strikethrough cterm=underline,strikethrough gui=underline,strikethrough"
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1222 VAR output = execute('highlight myhlg2')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1223 LET output = output->split("\n")->join()->substitute('\s\+', ' ', 'g')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1224 call assert_equal(expected, output)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1225 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
1226 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
1227 \ 'term': attr, 'cterm': attr}], hlget('myhlg2'))
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1228 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1229 call v9.CheckLegacyAndVim9Success(lines)
26119
0db507389fdb patch 8.2.3592: Test_hlset fails when terminal has many columns
Bram Moolenaar <Bram@vim.org>
parents: 26115
diff changeset
1230
26145
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1231 " Test for clearing the attributes and link of a highlight group
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1232 let lines =<< trim END
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1233 highlight myhlg3 ctermbg=green guibg=green
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1234 highlight! default link myhlg3 ErrorMsg
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1235 VAR id3 = hlID('myhlg3')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1236 call hlset([{'name': 'myhlg3', 'cleared': v:true, 'linksto': 'NONE'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1237 call assert_equal([{'id': id3, 'name': 'myhlg3', 'cleared': v:true}],
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1238 \ hlget('myhlg3'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1239 highlight clear hlg3
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1240 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1241 call v9.CheckLegacyAndVim9Success(lines)
26145
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1242
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1243 " Test for setting default attributes for a highlight group
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1244 let lines =<< trim END
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1245 call hlset([{'name': 'hlg4', 'ctermfg': '8'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1246 call hlset([{'name': 'hlg4', 'default': v:true, 'ctermfg': '9'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1247 VAR id4 = hlID('hlg4')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1248 call assert_equal([{'id': id4, 'name': 'hlg4', 'ctermfg': '8'}],
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1249 \ hlget('hlg4'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1250 highlight clear hlg4
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1251
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1252 call hlset([{'name': 'hlg5', 'default': v:true, 'ctermbg': '2'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1253 call hlset([{'name': 'hlg5', 'ctermbg': '4'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1254 VAR id5 = hlID('hlg5')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1255 call assert_equal([{'id': id5, 'name': 'hlg5', 'ctermbg': '4'}],
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1256 \ hlget('hlg5'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1257 highlight clear hlg5
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1258
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1259 call hlset([{'name': 'hlg6', 'linksto': 'Error'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1260 VAR id6 = hlID('hlg6')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1261 call hlset([{'name': 'hlg6', 'default': v:true, 'ctermbg': '2'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1262 call assert_equal([{'id': id6, 'name': 'hlg6', 'linksto': 'Error'}],
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1263 \ hlget('hlg6'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1264 highlight clear hlg6
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1265 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1266 call v9.CheckLegacyAndVim9Success(lines)
26145
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1267
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1268 " Test for setting default links for a highlight group
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1269 let lines =<< trim END
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1270 call hlset([{'name': 'hlg7', 'ctermfg': '5'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1271 call hlset([{'name': 'hlg7', 'default': v:true, 'linksto': 'Search'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1272 VAR id7 = hlID('hlg7')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1273 call assert_equal([{'id': id7, 'name': 'hlg7', 'ctermfg': '5'}],
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1274 \ hlget('hlg7'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1275 highlight clear hlg7
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1276
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1277 call hlset([{'name': 'hlg8', 'default': v:true, 'linksto': 'Search'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1278 VAR id8 = hlID('hlg8')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1279 call assert_equal([{'id': id8, 'name': 'hlg8', 'default': v:true,
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1280 \ 'linksto': 'Search'}], hlget('hlg8'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1281 call hlset([{'name': 'hlg8', 'ctermbg': '2'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1282 call assert_equal([{'id': id8, 'name': 'hlg8', 'ctermbg': '2'}],
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1283 \ hlget('hlg8'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1284 highlight clear hlg8
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1285
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1286 highlight default link hlg9 ErrorMsg
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1287 VAR hlg_save = hlget('hlg9')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1288 LET hlg_save[0]['name'] = 'hlg9dup'
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1289 call hlset(hlg_save)
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1290 VAR id9 = hlID('hlg9dup')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1291 highlight clear hlg9dup
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1292 call assert_equal([{'id': id9, 'name': 'hlg9dup', 'default': v:true,
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1293 \ 'linksto': 'ErrorMsg'}], hlget('hlg9dup'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1294 highlight clear hlg9
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1295 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1296 call v9.CheckLegacyAndVim9Success(lines)
26145
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1297
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1298 " Test for force creating a link to a highlight group
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1299 let lines =<< trim END
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1300 call hlset([{'name': 'hlg10', 'ctermfg': '8'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1301 call hlset([{'name': 'hlg10', 'linksto': 'Search'}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1302 VAR id10 = hlID('hlg10')
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1303 call assert_equal([{'id': id10, 'name': 'hlg10', 'ctermfg': '8'}],
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1304 \ hlget('hlg10'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1305 call hlset([{'name': 'hlg10', 'linksto': 'Search', 'force': v:true}])
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1306 call assert_equal([{'id': id10, 'name': 'hlg10', 'ctermfg': '8',
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1307 \ 'linksto': 'Search'}], hlget('hlg10'))
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1308 highlight clear hlg10
3da380450cce patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents: 26119
diff changeset
1309 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1310 call v9.CheckLegacyAndVim9Success(lines)
26274
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1311
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1312 " Test for empty values of attributes
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1313 call hlset([{'name': 'hlg11', 'cterm': {}}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1314 call hlset([{'name': 'hlg11', 'ctermfg': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1315 call hlset([{'name': 'hlg11', 'ctermbg': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1316 call hlset([{'name': 'hlg11', 'ctermul': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1317 call hlset([{'name': 'hlg11', 'font': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1318 call hlset([{'name': 'hlg11', 'gui': {}}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1319 call hlset([{'name': 'hlg11', 'guifg': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1320 call hlset([{'name': 'hlg11', 'guibg': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1321 call hlset([{'name': 'hlg11', 'guisp': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1322 call hlset([{'name': 'hlg11', 'start': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1323 call hlset([{'name': 'hlg11', 'stop': ''}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1324 call hlset([{'name': 'hlg11', 'term': {}}])
84eb3e0ad3f4 patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents: 26145
diff changeset
1325 call assert_true(hlget('hlg11')[0].cleared)
26089
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1326 endfunc
c544eacaf066 patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents: 26057
diff changeset
1327
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19273
diff changeset
1328 " vim: shiftwidth=2 sts=2 expandtab