Send an event before leave buffer in window

This commit is contained in:
__ 2021-02-06 14:48:39 +01:00 • committed by Ben Jackson
commit 840ee09242
3 changed files with 11 additions and 5 deletions

View file

@ -710,7 +710,6 @@ class DebugSession( object ):
self._stackTraceView.SetSyntax( self._codeView.current_syntax )
self._variablesView.LoadScopes( frame )
self._variablesView.EvaluateWatches()
vim.command( 'doautocmd <nomodeline> User VimspectorFrameWasSet' )
if reason == 'stopped':
self._breakpoints.ClearTemporaryBreakpoint( frame[ 'source' ][ 'path' ],

View file

@ -76,7 +76,14 @@ def WindowForBuffer( buf ):
def OpenFileInCurrentWindow( file_name ):
buffer_number = BufferNumberForFile( file_name )
try:
if "vimspectorStep" in vim.current.buffer.vars:
del vim.current.buffer.vars["vimspectorStep"]
# @todo: what if the same buffer is still visited by another thread
vim.command( 'doautocmd <nomodeline> User VimspectorFrameLeavePre' )
vim.current.buffer = vim.buffers[ buffer_number ]
vim.current.buffer.vars["vimspectorStep"] = 1
vim.command( 'doautocmd <nomodeline> User VimspectorFrameWasSet' )
except vim.error as e:
if 'E325' not in str( e ):
raise

View file

@ -410,16 +410,16 @@ function! Test_CustomWinBar()
%bwipe!
endfunction
function! Test_VimspectorFrameWasSet()
augroup TestVimspectorFrameWasSet
function! Test_VimspectorFrameEnter()
augroup TestVimspectorFrameEnter
au!
au User VimspectorFrameWasSet let b:vimspectorStepIsThere = 'foo'
au User VimspectorFrameEnter let b:vimspectorStepIsThere = 'foo'
augroup END
call s:StartDebugging()
call assert_equal( 'foo', getbufvar(bufnr(), 'vimspectorStepIsThere', 0) )
au! TestVimspectorFrameWasSet
au! TestVimspectorFrameEnter
unlet b:vimspectorStepIsThere
call vimspector#test#setup#Reset()
%bwipe!