highlighter: remove stale separator entries on buffer unload
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled

fixes: #2701

Co-authored-by: Mina Nagy Zaki <mnzaki@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-12-05 06:49:09 +01:00
parent 25635ab504
commit 7a552f415c
2 changed files with 25 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ function! s:init()
endfunction
let s:active_winnr = -1
function! s:on_window_changed(event)
" don't trigger for Vim popup windows
if &buftype is# 'popup'
@@ -67,11 +68,20 @@ function! s:on_window_changed(event)
\ && &ft !~? 'gitcommit'
" fugitive is special, it changes names and filetypes several times,
" make sure the caching does not get into its way
if a:event ==# 'BufUnload'
" in the BufUnload event, make sure the cacheing does not prevent
" removing stale entries
call airline#highlighter#remove_separators_for_bufnr(expand('<abuf>'))
endif
return
endif
let g:airline_last_window_changed = l:key
call s:init()
call airline#update_statusline()
if a:event ==# 'BufUnload'
call airline#highlighter#remove_separators_for_bufnr(expand('<abuf>'))
endif
endfunction
function! s:on_focus_gained()