better disabled highlighting for inactive windows on FocusLost
This will make sure that the current window will be highlighted as expected, even if there are no other windows and all highlighting groups will be correctly re-created as 'inactive' references #1807
This commit is contained in:
parent
c44bbc66f5
commit
d81cdacb1e
@ -115,6 +115,14 @@ function! airline#update_statusline()
|
|||||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! airline#update_statusline_focuslost()
|
||||||
|
if get(g:, 'airline_focuslost_inactive', 0)
|
||||||
|
let bufnr=bufnr('%')
|
||||||
|
call airline#highlighter#highlight_modified_inactive(bufnr)
|
||||||
|
call airline#highlighter#highlight(['inactive'], bufnr)
|
||||||
|
call airline#update_statusline_inactive(range(1, winnr('$')))
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
function! airline#update_statusline_inactive(range)
|
function! airline#update_statusline_inactive(range)
|
||||||
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
|
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
|
||||||
return
|
return
|
||||||
|
@ -223,11 +223,6 @@ function! airline#highlighter#highlight(modes, ...)
|
|||||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||||
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
|
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
|
||||||
for mode in mapped
|
for mode in mapped
|
||||||
if mode == 'inactive' && winnr('$') == 1
|
|
||||||
" there exist no inactive windows, don't need to create all those
|
|
||||||
" highlighting groups
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
|
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
|
||||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||||
for kvp in items(dict)
|
for kvp in items(dict)
|
||||||
|
@ -106,9 +106,7 @@ function! s:airline_toggle()
|
|||||||
autocmd TerminalOpen * call <sid>on_colorscheme_changed()
|
autocmd TerminalOpen * call <sid>on_colorscheme_changed()
|
||||||
endif
|
endif
|
||||||
" Set all statuslines to inactive
|
" Set all statuslines to inactive
|
||||||
autocmd FocusLost * if get(g:, 'airline_focuslost_inactive', 0)|
|
autocmd FocusLost * call airline#update_statusline_focuslost()
|
||||||
\ call airline#update_statusline_inactive(range(1, winnr('$')))|
|
|
||||||
\ endif
|
|
||||||
" Refresh airline for :syntax off
|
" Refresh airline for :syntax off
|
||||||
autocmd SourcePre */syntax/syntax.vim
|
autocmd SourcePre */syntax/syntax.vim
|
||||||
\ call airline#extensions#tabline#buffers#invalidate()
|
\ call airline#extensions#tabline#buffers#invalidate()
|
||||||
|
Loading…
Reference in New Issue
Block a user