@@ -1476,13 +1476,13 @@ function! Tlist_Balloon_Expr() abort
14761476 return s: Tlist_Get_Tag_Prototype (finfo.tags [tidx])
14771477endfunction
14781478
1479- " Tlist_Window_Exit_Only_Window
1480- " If the 'Tlist_Exit_OnlyWindow' option is set, then exit Vim if only the
1481- " taglist window is present.
1482- function ! s: Tlist_Window_Exit_Only_Window () abort
1479+ " Tlist_Exit_Only_Window_Callback
1480+ " Timer callback function to exit Vim or to close a tab page if the taglist
1481+ " window is the only window present.
1482+ function ! s: Tlist_Exit_Only_Window_Callback (timer_id)
14831483 " Before quitting Vim, delete the taglist buffer so that the '0 mark is
14841484 " correctly set to the previous buffer.
1485- if winbufnr (2 ) == -1
1485+ if winbufnr (2 ) == -1 && winbufnr ( 1 ) == bufnr ( s: TagList_title )
14861486 if tabpagenr (' $' ) == 1
14871487 " Only one tabpage is present.
14881488 "
@@ -1496,6 +1496,15 @@ function! s:Tlist_Window_Exit_Only_Window() abort
14961496 close
14971497 endif
14981498 endif
1499+ endfunc
1500+
1501+ " Tlist_Window_Exit_Only_Window
1502+ " If the 'Tlist_Exit_OnlyWindow' option is set, then exit Vim if only the
1503+ " taglist window is present.
1504+ function ! s: Tlist_Window_Exit_Only_Window () abort
1505+ " This is called from the BufEnter autocmd. Closing windows is not allowed
1506+ " from an autocmd event, so start a timer to make the changes.
1507+ call timer_start (0 , function (' s:Tlist_Exit_Only_Window_Callback' ))
14991508endfunction
15001509
15011510function ! s: Tlist_Menu_Add_Base_Menu () abort
0 commit comments