fix inactive modified arrow colors (#233).

This commit is contained in:
Bailey Ling 2013-09-07 13:00:10 +00:00
parent ad3556d243
commit d74b3bfdbf
2 changed files with 15 additions and 13 deletions

View File

@ -122,19 +122,6 @@ function! airline#check_mode(winnr)
if g:airline_detect_modified
if &modified
call add(l:mode, 'modified')
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
else
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
endif
if !empty(colors)
for winnr in range(1, winnr('$'))
if winnr != a:winnr && has_key(s:contexts, winnr) && s:contexts[winnr].bufnr == context.bufnr
call airline#highlighter#exec('airline_c'.(context.bufnr).'_inactive', colors)
endif
endfor
endif
endif
@ -144,6 +131,7 @@ function! airline#check_mode(winnr)
let mode_string = join(l:mode)
if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr)
call airline#highlighter#highlight(l:mode)
let w:airline_lastmode = mode_string
endif

View File

@ -91,6 +91,20 @@ function! airline#highlighter#add_separator(from, to, inverse)
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
endfunction
function! airline#highlighter#highlight_modified_inactive(bufnr)
if getbufvar(a:bufnr, '&modified')
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
else
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
endif
if !empty(colors)
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
endif
endfunction
function! airline#highlighter#highlight(modes)
" draw the base mode, followed by any overrides
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')