Update each window only once in s:on_window_changed.

We might come there several times for different autocommands.

The key uses bufnr/winnr and the number of total windows, and is stored
for the tab.
This commit is contained in:
Daniel Hahler 2016-04-20 21:06:04 +02:00
parent 95237f6604
commit abcb3c4bb3
1 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,13 @@ function! s:on_window_changed()
if pumvisible() && (!&previewwindow || g:airline_exclude_preview)
return
endif
" Handle each window only once, since we might come here several times for
" different autocommands.
let l:key = [bufnr('%'), winnr(), winnr('$')]
if get(t:, 'airline_last_window_changed', []) == l:key
return
endif
let t:airline_last_window_changed = l:key
call s:init()
call airline#update_statusline()
endfunction