Raise an autocommand for the terminal too

This commit is contained in:
Ben Jackson 2020-07-11 22:33:02 +01:00
commit 3beb25f949
2 changed files with 14 additions and 8 deletions

View file

@ -100,7 +100,8 @@ command! -bar
" Dummy autocommands so that we can call this whenever " Dummy autocommands so that we can call this whenever
augroup VimspectorUserAutoCmds augroup VimspectorUserAutoCmds
au! au!
au User VimspectorUICreated silent au User VimspectorUICreated silent
au User VimspectorTerminalOpened silent
augroup END augroup END
" boilerplate {{{ " boilerplate {{{

View file

@ -228,7 +228,7 @@ class CodeView( object ):
if self._window.valid: if self._window.valid:
window_for_start = self._window window_for_start = self._window
else: else:
# TOOD: Where? # TOOD: Where? Maybe we should just use botright vertical ...
window_for_start = vim.current.window window_for_start = vim.current.window
if self._terminal_window is not None and self._terminal_window.valid: if self._terminal_window is not None and self._terminal_window.valid:
@ -255,11 +255,16 @@ class CodeView( object ):
if buffer_number is None or buffer_number <= 0: if buffer_number is None or buffer_number <= 0:
# TODO: Do something better like reject the request? # TODO: Do something better like reject the request?
raise ValueError( "Unable to start terminal" ) raise ValueError( "Unable to start terminal" )
else:
self._terminal_window = terminal_window self._terminal_window = terminal_window
self._terminal_buffer_number = buffer_number self._terminal_buffer_number = buffer_number
vim.vars[ 'vimspector_session_windows' ][ 'terminal' ] = utils.WindowID(
self._terminal_window, vim.vars[ 'vimspector_session_windows' ][ 'terminal' ] = utils.WindowID(
vim.current.tabpage ) self._terminal_window,
vim.current.tabpage )
with utils.RestoreCursorPosition():
with utils.RestoreCurrentWindow():
with utils.RestoreCurrentBuffer( vim.current.window ):
vim.command( 'doautocmd User VimspectorTerminalOpened' )
return buffer_number return buffer_number