Update to handle vim-8 and vim-9 and rework a couple other spots

This commit is contained in:
raven42 2024-02-29 16:39:59 -06:00
parent 43104f3b08
commit 89d99497b2

View File

@ -3522,13 +3522,17 @@ function! s:HandleOnlyWindow() abort
let file_open = s:HasOpenFileWindows()
if vim_quitting && file_open == 2 && !g:tagbar_autoclose_netrw
call tagbar#debug#log('Closing Tagbar due to QuitPre - netrw only remaining window')
call s:CloseWindow()
call tagbar#debug#log('Closing Tagbar due to QuitPre - leave netrw')
if has('patch-9.0.907')
call timer_start(10, {-> s:CloseWindow() })
else
call s:CloseWindow()
endif
return
endif
if vim_quitting && file_open != 1
call tagbar#debug#log('Closing Tagbar window due to QuitPre event')
call tagbar#debug#log('Closing Tagbar and netrw due to QuitPre event')
if winnr('$') >= 1
call s:goto_win(tagbarwinnr, 1)
endif
@ -3536,12 +3540,19 @@ function! s:HandleOnlyWindow() abort
" Before quitting Vim, delete the tagbar buffer so that the '0 mark is
" correctly set to the previous buffer.
if tabpagenr('$') == 1
noautocmd keepalt bdelete
if has('patch-9.0.907')
call timer_start(20, {-> execute('noautocmd keepalt bdelete ' . tagbarwinnr)})
else
noautocmd keepalt bdelete
endif
endif
try
try
call timer_start(0, {-> execute('q', 'silent!') })
if has('patch-9.0.907')
call timer_start(50, {-> execute('q', 'silent!') })
else
quit
endif
catch /.*/ " This can be E173 and maybe others
call s:OpenWindow('')
echoerr v:exception