annotate src/testdir/test_highlight.vim @ 12580:ba55861aa52c v8.0.1168

patch 8.0.1168: wrong highlighting with combination of match and 'cursorline' commit https://github.com/vim/vim/commit/0aa398f55a327282c70f56e0bac2dcb9521da378 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 30 21:23:55 2017 +0200 patch 8.0.1168: wrong highlighting with combination of match and 'cursorline' Problem: wrong highlighting with combination of match and 'cursorline'. Solution: Use "line_attr" when appropriate. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/2111) But don't highlight more than one character.
author Christian Brabandt <cb@256bit.org>
date Sat, 30 Sep 2017 21:30:05 +0200
parents 7d7835ab8b37
children 97f0c74976c6
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
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
4
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_highlight()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " 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
7 highlight
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 hi Search
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " test setting colors.
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " 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
12 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
13 silent! hi Group2 term= cterm=
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 hi Group3 term=underline cterm=bold
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 " 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
18 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
19 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
20 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
21 \ res)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 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
25 \ split(execute("hi Group3"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 hi clear NewGroup
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal("NewGroup xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 \ split(execute("hi NewGroup"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 hi Group2 NONE
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal("Group2 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ split(execute("hi Group2"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 hi clear
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal("Group3 xxx cleared",
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ split(execute("hi Group3"), "\n")[0])
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_fails("hi Crash term='asdf", "E475:")
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 endfunc
12580
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
40
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
41 function! HighlightArgs(name)
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
42 return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\<xxx\>', '', '')
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
43 endfunction
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
44
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
45 function! IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
46 return has('gui_running') || str2nr(&t_Co) >= 8
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
47 endfunction
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
48
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
49 function! HiCursorLine()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
50 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
51 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
52 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
53 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
54 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
55 else
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
56 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
57 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
58 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
59 return [hiCursorLine, hi_ul, hi_bg]
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
60 endfunction
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
61
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
62 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
63 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
64
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
65 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
66 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
67 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
68
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
69 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
70 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
71 " ^^^^ ^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
72 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
73 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
74 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
75 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
76 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
77
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
78 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
79
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
80 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
81 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
82
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
83 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
84 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
85 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
86 " ^^^^^^ 'Search' highlight with underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
87 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
88 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
89 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
90 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
91 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
92 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
93 call assert_notequal(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
94
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
95 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
96 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
97 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
98
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
99 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
100 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
101 " ^^^^ 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
102 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
103 " ^^^^^ 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
104 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
105 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
106 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
107 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
108 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
109 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
110 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
111 call assert_notequal(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
112 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
113
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
114 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
115 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
116 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
117
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
118 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
119 if !has('vertsplit')
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
120 return
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
121 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
122
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
123 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
124
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
125 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
126 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
127 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
128
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
129 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
130 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
131 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
132
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
133 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
134 " 'abcd |abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
135 " ^^^^ ^^^^^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
136 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
137 " ^ 'VertSplit' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
138 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
139 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
140 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
141 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
142 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
143 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
144
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
145 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
146
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
147 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
148 " 'abcd |abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
149 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
150 " ^ '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
151 " ^ 'VertSplit' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
152 " ^^^^^^^^^ no highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
153
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
154 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
155 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
156
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
157 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
158 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
159
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
160 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 call assert_notequal(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
171
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
172 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
173 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
174 exe hi_bg
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
175
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
176 let actual = ScreenLines(1, 15)[0]
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
177 call assert_equal(expected, actual)
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
178
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
179 let attrs = ScreenAttrs(1, 15)[0]
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
180 call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
181 call assert_equal(repeat([attrs[6]], 9), attrs[6:14])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
182 call assert_equal(attrs0[5:14], attrs[5:14])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
183 call assert_notequal(attrs[0], attrs[4])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
184 call assert_notequal(attrs[0], attrs[5])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
185 call assert_notequal(attrs[0], attrs[6])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
186 call assert_notequal(attrs[4], attrs[5])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
187 call assert_notequal(attrs[5], attrs[6])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
188 call assert_notequal(attrs0[0], attrs[0])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
189 call assert_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
190 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
191
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
192 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
193 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
194 endfunc
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 func Test_highlight_eol_with_cursorline_rightleft()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
197 if !has('rightleft')
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
198 return
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
199 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
200
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
201 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
202
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
203 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
204 setlocal rightleft
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
205 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
206 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
207 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
208
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
209 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
210
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
211 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
212 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
213
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
214 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
215 " ' dcba'
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
216 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
217 " ^ '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
218 " ^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
219 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
220 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
221 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
222 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
223 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
224 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
225 call assert_notequal(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
226
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
227 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
228 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
229 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
230
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
231 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
232 " ' dcba'
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
233 " ^^^^ 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
234 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
235 " ^^^^^ 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
236 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
237 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
238 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
239 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
240 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
241 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
242 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
243 call assert_notequal(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
244 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
245
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
246 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
247 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
248 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
249
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
250 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
251 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
252
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
253 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
254 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
255 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
256
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
257 setlocal wrap
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
258 normal! gg$
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
259 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
260 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
261
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
262 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
263 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
264
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
265 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
266 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
267 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
268 " ^ '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
269 " ^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
270 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
271 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
272 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
273 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
274 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
275 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
276 call assert_notequal(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
277
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
278 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
279 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
280 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
281
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
282 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
283 " 'abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
284 " ^^^^ 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
285 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
286 " ^^^^^ 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
287 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
288 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
289 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
290 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
291 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
292 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
293 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
294 call assert_notequal(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
295 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
296
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
297 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
298 normal! gg$
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
299 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
300 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
301
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
302 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
303 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
304
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
305 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
306 " 'aaabcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
307 " ^^^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
308 " ^ '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
309 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
310 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
311 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
312 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
313 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
314 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
315 call assert_notequal(attrs0[0], attrs[0])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
316 call assert_notequal(attrs0[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
317
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
318 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
319 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
320 exe hi_bg
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
321
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
322 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
323 " 'aaabcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
324 " ^^^^^^ 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
325 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
326 " ^^^ 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
327 let attrs = ScreenAttrs(1, 10)[0]
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
328 call assert_equal(repeat([attrs[0]], 6), attrs[0:5])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
329 call assert_equal(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
330 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
331 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
332 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
333 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
334 call assert_notequal(attrs0[7], attrs[7])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
335 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
336
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
337 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
338 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
339 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
340
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
341 func Test_highlight_eol_with_cursorline_sign()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
342 if !has('signs')
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
343 return
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
344 endif
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 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
347
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
348 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
349 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
350 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
351
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
352 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
353 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
354 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
355 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
356
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
357 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
358 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
359
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
360 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
361 " '>>abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
362 " ^^ sign
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
363 " ^^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
364 " ^ '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
365 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
366 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
367 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
368 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
369 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
370 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
371 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
372 call assert_notequal(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
373
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
374 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
375 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
376 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
377
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
378 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
379 " '>>abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
380 " ^^ sign
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
381 " ^^^^ 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
382 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
383 " ^^^ 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
384 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
385 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
386 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
387 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
388 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
389 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
390 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
391 call assert_notequal(attrs0[7], attrs[7])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
392 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
393
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
394 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
395 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
396 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
397 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
398
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
399 func Test_highlight_eol_with_cursorline_breakindent()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
400 if !has('linebreak')
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
401 return
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
402 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
403
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
404 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
405
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
406 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
407 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
408 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
409 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
410 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
411 setlocal cursorline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
412
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
413 " underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
414 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
415
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
416 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
417 " ' >bcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
418 " ^^^ 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
419 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
420 " ^ '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
421 " ^^^ underline
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
422 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
423 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
424 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
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 call assert_notequal(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
434
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
435 if IsColorable()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
436 " bg-color
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
437 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
438
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
439 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
440 " ' >bcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
441 " ^^^ 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
442 " ^^^ 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
443 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
444 " ^^^ 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
445 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
446 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
447 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
448 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
449 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
450 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
451 call assert_notequal(attrs[0], attrs[2])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
452 call assert_notequal(attrs[2], attrs[3])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
453 call assert_notequal(attrs[3], attrs[6])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
454 call assert_notequal(attrs[6], attrs[7])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
455 call assert_notequal(attrs0[2], attrs[2])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
456 call assert_notequal(attrs0[3], attrs[3])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
457 call assert_notequal(attrs0[7], attrs[7])
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
458 endif
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
459
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
460 call CloseWindow()
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
461 set showbreak=
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
462 exe hiCursorLine
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
463 endfunc
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
464
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
465 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
466 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
467 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
468 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
469
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
470 diffthis
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
471 botright new
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
472 diffthis
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
473
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
474 " expected:
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
475 " ' abcd '
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
476 " ^^ sign
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
477 " ^^^^ ^^^ 'DiffAdd' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
478 " ^ 'Search' highlight
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
479 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
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
488 bwipe!
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
489 diffoff
ba55861aa52c patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
490 endfunc