highlight: correctly cache and restore reverse attributes for highlighting colors

references #1779
This commit is contained in:
Christian Brabandt 2018-10-16 12:02:44 +02:00
parent 7e004804d1
commit 726b730f0a
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -53,15 +53,16 @@ function! airline#highlighter#reset_hlcache()
endfunction
function! airline#highlighter#get_highlight(group, ...)
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
return s:hl_groups[a:group]
else
let fg = s:get_syn(a:group, 'fg')
let bg = s:get_syn(a:group, 'bg')
let reverse = g:airline_gui_mode ==# 'gui'
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
let res = s:hl_groups[a:group]
return reverse ? [ res[1], res[0], res[3], res[2], res[4] ] : res
else
let fg = s:get_syn(a:group, 'fg')
let bg = s:get_syn(a:group, 'bg')
let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
let opts = a:000
if bold
@ -165,9 +166,9 @@ function! s:exec_separator(dict, from, to, inverse, suffix)
if pumvisible()
return
endif
let group = a:from.'_to_'.a:to.a:suffix
let l:from = airline#themes#get_highlight(a:from.a:suffix)
let l:to = airline#themes#get_highlight(a:to.a:suffix)
let group = a:from.'_to_'.a:to.a:suffix
if a:inverse
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
else