Save last alt bufnr before switching buffers, closes #385

When switching buffers during the handling of the BufDelete event the
saved buffer number of the last alternate buffer will change, so we have
to save a local copy to be able to properly unset the 'tagbar_ignore'
buffer variable.
This commit is contained in:
Jan Larres 2017-01-03 15:21:10 +13:00
parent 51e6e3b66a
commit 18b536ce43

View File

@ -4193,11 +4193,15 @@ function! s:HandleBufDelete(bufname, bufnr) abort
enew
endif
else
" Save a local copy as the global value will change
" during buffer switching
let last_alt_bufnr = s:last_alt_bufnr
" Ignore the buffer we're switching to for now, it will get
" processed due to the OpenWindow() call anyway
call setbufvar(s:last_alt_bufnr, 'tagbar_ignore', 1)
execute 'keepalt buffer' s:last_alt_bufnr
call setbufvar(s:last_alt_bufnr, 'tagbar_ignore', 0)
call setbufvar(last_alt_bufnr, 'tagbar_ignore', 1)
execute 'keepalt buffer' last_alt_bufnr
call setbufvar(last_alt_bufnr, 'tagbar_ignore', 0)
endif
" Reset Tagbar window-local options