Skip to content

Commit

Permalink
Potential fix for preservim#772 - InitWindow issue
Browse files Browse the repository at this point in the history
Potential fix for preservim#772

This issue is being caused by the InitWindow() routine not being called
when a split of the tagbar window occurs. This will potentially fix that
issue by forceably calling s:InitWindow() when a new tagbar window is
found.

Note however, that when closing one of the split tagbar windows, it does
cause the other one to close as well. It looks like there is an issue on
the close processing that it identifies all windows that have the tagbar
buffer loaded as the tagbar window.
  • Loading branch information
raven42 committed Jun 18, 2021
1 parent 225e653 commit 98bf0b0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/tagbar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ function! s:CreateAutocommands() abort

autocmd WinEnter * if bufwinnr(s:TagbarBufName()) == -1 |
\ call s:ShrinkIfExpanded() |
\ else |
\ call s:InitWindow(g:tagbar_autoclose) |
\ endif

autocmd BufWritePost *
Expand Down Expand Up @@ -968,6 +970,10 @@ endfunction
function! s:InitWindow(autoclose) abort
call tagbar#debug#log('InitWindow called with autoclose: ' . a:autoclose)

if exists('w:tagbar_win_init')
call tagbar#debug#log('InitWindow - already initialized this window')
return
endif
" Buffer-local options

setlocal filetype=tagbar
Expand Down Expand Up @@ -1051,6 +1057,7 @@ function! s:InitWindow(autoclose) abort
let s:expand_bufnr = bufnr('%')
endif

let w:tagbar_win_init = 1
call tagbar#debug#log('InitWindow finished')
endfunction

Expand Down Expand Up @@ -1109,6 +1116,7 @@ function! s:CloseWindow() abort
call tagbar#StopAutoUpdate()
endif

unlet w:tagbar_win_init
call tagbar#debug#log('CloseWindow finished')
endfunction

Expand Down

0 comments on commit 98bf0b0

Please sign in to comment.