Revert "highlighter: Make the separators use a cterm background color"

This reverts commit e72a7e2c8d.
This commit is contained in:
Christian Brabandt 2018-03-20 15:30:02 +01:00
parent d2ac3d5755
commit b9f55455fb
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 8 additions and 16 deletions

View File

@ -22,18 +22,17 @@ function! s:gui2cui(rgb, fallback)
return airline#msdos#round_msdos_colors(rgb) return airline#msdos#round_msdos_colors(rgb)
endfunction endfunction
function! s:get_syn(group, what, ...) function! s:get_syn(group, what)
if !exists("g:airline_gui_mode") if !exists("g:airline_gui_mode")
let g:airline_gui_mode = airline#init#gui_mode() let g:airline_gui_mode = airline#init#gui_mode()
endif endif
let mode = a:0 ? 'cterm' : g:airline_gui_mode
let color = '' let color = ''
if hlexists(a:group) if hlexists(a:group)
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, mode) let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
endif endif
if empty(color) || color == -1 if empty(color) || color == -1
" should always exists " should always exists
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, mode) let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
" however, just in case " however, just in case
if empty(color) || color == -1 if empty(color) || color == -1
let color = 'NONE' let color = 'NONE'
@ -49,11 +48,6 @@ function! s:get_array(fg, bg, opts)
\ : [ '', '', a:fg, a:bg, opts ] \ : [ '', '', a:fg, a:bg, opts ]
endfunction endfunction
function! s:get_array_full(fg, bg, ctermfg, ctermbg, opts)
let opts=empty(a:opts) ? '' : join(a:opts, ',')
return [ a:fg, a:bg, a:ctermfg, a:ctermbg, opts ]
endfunction
function! airline#highlighter#reset_hlcache() function! airline#highlighter#reset_hlcache()
let s:hl_groups = {} let s:hl_groups = {}
endfunction endfunction
@ -62,8 +56,8 @@ function! airline#highlighter#get_highlight(group, ...)
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group) if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
return s:hl_groups[a:group] return s:hl_groups[a:group]
else else
let [fg, bg] = [s:get_syn(a:group, 'fg'), s:get_syn(a:group, 'bg')] let fg = s:get_syn(a:group, 'fg')
let [ctermfg, ctermbg] = [s:get_syn(a:group, 'fg', 1), s:get_syn(a:group, 'bg', 1)] let bg = s:get_syn(a:group, 'bg')
let reverse = g:airline_gui_mode ==# 'gui' let reverse = g:airline_gui_mode ==# 'gui'
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') \ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm') \ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
@ -73,9 +67,7 @@ function! airline#highlighter#get_highlight(group, ...)
if bold if bold
let opts = ['bold'] let opts = ['bold']
endif endif
let res = reverse ? let res = reverse ? s:get_array(bg, fg, opts) : s:get_array(fg, bg, opts)
\ s:get_array_full(bg, fg, ctermbg, ctermfg, opts) :
\ s:get_array_full(fg, bg, ctermfg, ctermbg, opts)
endif endif
let s:hl_groups[a:group] = res let s:hl_groups[a:group] = res
return res return res
@ -173,8 +165,8 @@ function! s:exec_separator(dict, from, to, inverse, suffix)
if pumvisible() if pumvisible()
return return
endif endif
let l:from = airline#highlighter#get_highlight(a:from.a:suffix) let l:from = airline#themes#get_highlight(a:from.a:suffix)
let l:to = airline#highlighter#get_highlight(a:to.a:suffix) let l:to = airline#themes#get_highlight(a:to.a:suffix)
let group = a:from.'_to_'.a:to.a:suffix let group = a:from.'_to_'.a:to.a:suffix
if a:inverse if a:inverse
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]