check existence of inactive modified colors before using them.

This commit is contained in:
Bailey Ling 2013-09-05 21:01:08 +00:00
parent 3c49b9cf3d
commit 46db9b9bdf
1 changed files with 15 additions and 9 deletions

View File

@ -122,18 +122,24 @@ function! airline#check_mode(winnr)
if g:airline_detect_modified
if &modified
call add(l:mode, 'modified')
let colors = g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c
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 = g:airline#themes#{g:airline_theme}#palette.inactive.airline_c
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c
\ : []
endif
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
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
if g:airline_detect_paste && &paste