1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

HandleBufDelete: Ignore apparent 'set nobuflisted' events

This commit is contained in:
Martin Vuille
2016-12-16 16:08:28 -05:00
parent 1374077676
commit 5b563a0d2d

View File

@@ -1076,7 +1076,7 @@ function! s:CreateAutocommands() abort
autocmd BufReadPost,BufEnter,CursorHold,FileType * call
\ s:AutoUpdate(fnamemodify(expand('<afile>'), ':p'), 0)
autocmd BufDelete,BufWipeout *
\ nested call s:HandleBufDelete(expand('<afile>'))
\ nested call s:HandleBufDelete(expand('<afile>'), expand('<abuf>'))
" Suspend Tagbar while grep commands are running, since we don't want
" to process files that only get loaded temporarily to search them
@@ -4159,7 +4159,13 @@ function! s:HandleOnlyWindow() abort
endfunction
" s:HandleBufDelete() {{{2
function! s:HandleBufDelete(bufname) abort
function! s:HandleBufDelete(bufname, bufnr) abort
" Ignore autocmd events generated for "set nobuflisted",
let nr = +a:bufnr " bufnr is passed as a string
if bufexists(nr) && !buflisted(nr)
return
endif
let tagbarwinnr = bufwinnr(s:TagbarBufName())
if tagbarwinnr == -1 || a:bufname =~ '__Tagbar__.*'
return