Skip to content

Commit ef785fb

Browse files
committed
Ensure vim popup callback called when leaving opener
Needed to ensure the popup is not only closed, but opener buffer local variable storing a reference to the popup object/dict also removed. Without this switching windows or buffers while the popup is open leaves the buffer local var behind and breaks future calls to :GitMessenger
1 parent 620b710 commit ef785fb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

autoload/gitmessenger/popup.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ function! s:popup__open() dict abort
299299
" Allow multiple invocations of :GitMessenger command to toggle popup
300300
" See gitmessenger#popup#close_current_popup() and gitmessenger#new()
301301
let b:__gitmessenger_popup = self " local to opener, removed by callback
302+
" Also ensure popup closed and callback called when leaving opener
303+
autocmd BufWipeout,BufLeave <buffer> ++once silent! call b:__gitmessenger_popup.close()
302304
let self.bufnr = winbufnr(win_id)
303305
let self.win_id = win_id
304306
return

0 commit comments

Comments
 (0)