Get rid of g:airline_gui_mode

This is needed for Neovim, because an external UI could be attached to
the same neovim server, so it does not make sense to define highlighting
groups with either only the cterm or the guifg attribute set.

So refactor the code slightly got get rid of this variable (and since
this variable is not needed anymore, we can also get rid of the guienter
and OptionSet autocommand).

fixes: #2261
This commit is contained in:
Christian Brabandt
2020-10-26 21:16:31 +01:00
parent 38c9f9ca3d
commit c8c0e7d9ff
6 changed files with 73 additions and 63 deletions

View File

@@ -6,9 +6,20 @@ describe 'highlighter'
hi Foo2 ctermfg=3 ctermbg=4
call airline#highlighter#add_separator('Foo1', 'Foo2', 0)
let hl = airline#highlighter#get_highlight('Foo1_to_Foo2')
Expect hl == [ '', '', '4', '2', '' ]
Expect hl == [ 'NONE', 'NONE', '4', '2', '' ]
end
if exists("+termguicolors")
it 'should create separator highlight groups with termguicolors'
set termguicolors
hi Foo1 guifg=#cd0000 guibg=#00cd00 ctermfg=1 ctermbg=2
hi Foo2 guifg=#cdcd00 guibg=#0000ee ctermfg=3 ctermbg=4
call airline#highlighter#add_separator('Foo1', 'Foo2', 0)
let hl = airline#highlighter#get_highlight('Foo1_to_Foo2')
Expect hl == [ '#0000ee', '#00cd00', '4', '2', '' ]
end
endif
it 'should populate accent colors'
Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false
Expect hlID('airline_c_red') == 0

View File

@@ -8,23 +8,42 @@ describe 'themes'
call airline#highlighter#reset_hlcache()
highlight Foo ctermfg=1 ctermbg=2
let colors = airline#themes#get_highlight('Foo')
Expect colors[0] == 'NONE'
Expect colors[1] == 'NONE'
Expect colors[2] == '1'
Expect colors[3] == '2'
end
if exists("+termguicolors")
it 'should extract correct colors with termguicolors'
call airline#highlighter#reset_hlcache()
set termguicolors
highlight Foo guifg=#cd0000 guibg=#00cd00 ctermfg=1 ctermbg=2
let colors = airline#themes#get_highlight('Foo')
Expect colors[0] == '#cd0000'
Expect colors[1] == '#00cd00'
Expect colors[2] == '1'
Expect colors[3] == '2'
end
endif
it 'should extract from normal if colors unavailable'
call airline#highlighter#reset_hlcache()
highlight Normal ctermfg=100 ctermbg=200
highlight Foo ctermbg=2
let colors = airline#themes#get_highlight('Foo')
Expect colors[0] == 'NONE'
Expect colors[1] == 'NONE'
Expect colors[2] == '100'
Expect colors[3] == '2'
end
it 'should flip target group if it is reversed'
call airline#highlighter#reset_hlcache()
highlight Foo ctermbg=222 ctermfg=103 term=reverse
highlight Foo ctermbg=222 ctermfg=103 cterm=reverse
let colors = airline#themes#get_highlight('Foo')
Expect colors[0] == 'NONE'
Expect colors[1] == 'NONE'
Expect colors[2] == '222'
Expect colors[3] == '103'
end
@@ -33,10 +52,10 @@ describe 'themes'
call airline#highlighter#reset_hlcache()
hi clear Normal
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic']
Expect hl == ['NONE', 'NONE', 'NONE', 'NONE', 'bold,italic']
let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold')
Expect hl == ['', '', 'NONE', 'NONE', 'italic,bold']
Expect hl == ['NONE', 'NONE', 'NONE', 'NONE', 'italic,bold']
end
it 'should generate color map with mirroring'