main: do not trigger FocusGained on startup
commit f045452743
introduced the
FocusGained autocommand. Unfortunately, for some systems this might
trigger already at startup, resulting in an unwanted redraw that might
clear the intro screen.
Therefore, add a timer, that enables the FocusGained autocommand after 5
seconds. The 5 seconds is somewhat arbritrarely, but we could change it
later if it turns out to be not useable.
fixes #1817
This commit is contained in:
parent
776f7aa948
commit
33a633766d
|
@ -7,6 +7,7 @@ if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_airline = 1
|
let g:loaded_airline = 1
|
||||||
|
let s:has_timers = has("timers")
|
||||||
|
|
||||||
let s:airline_initialized = 0
|
let s:airline_initialized = 0
|
||||||
function! s:init()
|
function! s:init()
|
||||||
|
@ -121,7 +122,16 @@ function! s:airline_toggle()
|
||||||
\ | call <sid>on_window_changed()
|
\ | call <sid>on_window_changed()
|
||||||
\ | endif
|
\ | endif
|
||||||
|
|
||||||
autocmd VimResized,FocusGained * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
autocmd VimResized * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||||
|
if s:has_timers
|
||||||
|
" do not trigger FocusGained on startup, it might erase the intro
|
||||||
|
" screen (see #1817)
|
||||||
|
let Handler=funcref('<sid>FocusGainedHandler')
|
||||||
|
let s:timer=timer_start(5000, Handler)
|
||||||
|
else
|
||||||
|
autocmd FocusGained * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||||
|
endif
|
||||||
|
|
||||||
autocmd TabEnter * :unlet! w:airline_lastmode | let w:airline_active=1
|
autocmd TabEnter * :unlet! w:airline_lastmode | let w:airline_active=1
|
||||||
autocmd BufWritePost */autoload/airline/themes/*.vim
|
autocmd BufWritePost */autoload/airline/themes/*.vim
|
||||||
\ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0]
|
\ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0]
|
||||||
|
@ -163,6 +173,14 @@ function! s:airline_refresh()
|
||||||
call airline#update_statusline()
|
call airline#update_statusline()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:FocusGainedHandler(timer)
|
||||||
|
if exists("s:timer") && a:timer == s:timer
|
||||||
|
augroup airline
|
||||||
|
au FocusGained * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
endfu
|
||||||
|
|
||||||
command! -bar -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
|
command! -bar -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
|
||||||
command! -bar AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
|
command! -bar AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
|
||||||
command! -bar AirlineToggle call s:airline_toggle()
|
command! -bar AirlineToggle call s:airline_toggle()
|
||||||
|
|
Loading…
Reference in New Issue