plugin: make the on_window_changed function take the autocommand as argument

This is just for making it easier to debug why the plugin update called
This commit is contained in:
Christian Brabandt 2019-06-03 08:30:27 +02:00
parent 3921bc13a3
commit 7d5302b51f
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -45,7 +45,7 @@ function! s:init()
endfunction endfunction
let s:active_winnr = -1 let s:active_winnr = -1
function! s:on_window_changed() function! s:on_window_changed(event)
let s:active_winnr = winnr() let s:active_winnr = winnr()
if pumvisible() && (!&previewwindow || g:airline_exclude_preview) if pumvisible() && (!&previewwindow || g:airline_exclude_preview)
@ -68,7 +68,7 @@ endfunction
function! s:on_cursor_moved() function! s:on_cursor_moved()
if winnr() != s:active_winnr if winnr() != s:active_winnr
call s:on_window_changed() call s:on_window_changed('CursorMoved')
endif endif
call airline#update_tabline() call airline#update_tabline()
endfunction endfunction
@ -114,7 +114,7 @@ function! s:airline_toggle()
autocmd CmdwinEnter * autocmd CmdwinEnter *
\ call airline#add_statusline_func('airline#cmdwinenter') \ call airline#add_statusline_func('airline#cmdwinenter')
\ | call <sid>on_window_changed() \ | call <sid>on_window_changed('CmdwinEnter')
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter') autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed() autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
@ -127,10 +127,13 @@ function! s:airline_toggle()
" 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()
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload * autocmd VimEnter * call <sid>on_window_changed('VimEnter')
\ call <sid>on_window_changed() autocmd WinEnter * call <sid>on_window_changed('WinEnter')
autocmd FileType * call <sid>on_window_changed('FileType')
autocmd BufWinEnter * call <sid>on_window_changed('BufWinEnter')
autocmd BufUnload * call <sid>on_window_changed('BufUnload')
if exists('##CompleteDone') if exists('##CompleteDone')
autocmd CompleteDone * call <sid>on_window_changed() autocmd CompleteDone * call <sid>on_window_changed('CompleteDone')
endif endif
" non-trivial number of external plugins use eventignore=all, so we need to account for that " non-trivial number of external plugins use eventignore=all, so we need to account for that
autocmd CursorMoved * call <sid>on_cursor_moved() autocmd CursorMoved * call <sid>on_cursor_moved()
@ -166,7 +169,7 @@ function! s:airline_toggle()
set laststatus=2 set laststatus=2
endif endif
if s:airline_initialized if s:airline_initialized
call s:on_window_changed() call s:on_window_changed('Init')
endif endif
call airline#util#doautocmd('AirlineToggledOn') call airline#util#doautocmd('AirlineToggledOn')