Wrap the terminal API in vimscript layer
This commit is contained in:
parent
d1e3b648d3
commit
ee1bb009ea
5 changed files with 50 additions and 15 deletions
|
|
@ -214,8 +214,8 @@ class CodeView( object ):
|
|||
if self._terminal_window is not None:
|
||||
assert self._terminal_buffer_number
|
||||
if ( self._terminal_window.buffer.number == self._terminal_buffer_number
|
||||
and 'finished' in vim.eval( 'term_getstatus( {} )'.format(
|
||||
self._terminal_buffer_number ) ) ):
|
||||
and int( utils.Call( 'vimspector#internal#term#IsFinished',
|
||||
self._terminal_buffer_number ) ) ):
|
||||
window_for_start = self._terminal_window
|
||||
options[ 'curwin' ] = 1
|
||||
|
||||
|
|
@ -224,13 +224,9 @@ class CodeView( object ):
|
|||
with utils.TemporaryVimOptions( { 'splitright': True,
|
||||
'equalalways': False } ):
|
||||
with utils.LetCurrentWindow( window_for_start ):
|
||||
# TODO/FIXME: Do something about closing this when we reset ?
|
||||
vim_cmd = 'term_start( {}, {} )'.format( json.dumps( args ),
|
||||
json.dumps( options ) )
|
||||
|
||||
self._logger.debug( 'Start terminal: {}'.format( vim_cmd ) )
|
||||
|
||||
buffer_number = int( vim.eval( vim_cmd ) )
|
||||
buffer_number = int( utils.Call( 'vimspector#internal#term#Start',
|
||||
args,
|
||||
options ) )
|
||||
terminal_window = vim.current.window
|
||||
|
||||
if buffer_number is None or buffer_number <= 0:
|
||||
|
|
|
|||
|
|
@ -798,8 +798,8 @@ class DebugSession( object ):
|
|||
buffer_number = self._codeView.LaunchTerminal( params )
|
||||
|
||||
response = {
|
||||
'processId': vim.eval( 'job_info( term_getjob( {} ) )'
|
||||
'.process'.format( buffer_number ) )
|
||||
'processId': int( utils.Call( 'vimspector#internal#term#GetPID',
|
||||
buffer_number ) )
|
||||
}
|
||||
|
||||
self._connection.DoResponse( message, None, response )
|
||||
|
|
|
|||
|
|
@ -455,11 +455,13 @@ def ToUnicode( b ):
|
|||
def Call( vimscript_function, *args ):
|
||||
call = vimscript_function + '('
|
||||
for index, arg in enumerate( args ):
|
||||
if index > 0:
|
||||
call += ', '
|
||||
|
||||
arg_name = 'vimspector_internal_arg_{}'.format( index )
|
||||
vim.vars[ arg_name ] = arg
|
||||
call += 'g:' + arg_name
|
||||
if index:
|
||||
call += ','
|
||||
|
||||
call += ')'
|
||||
vim.eval( call )
|
||||
_logger.debug( 'Calling: {}'.format( call ) )
|
||||
return vim.eval( call )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue