diff --git a/python3/vimspector/utils.py b/python3/vimspector/utils.py index 647988d..8c63d55 100644 --- a/python3/vimspector/utils.py +++ b/python3/vimspector/utils.py @@ -343,3 +343,11 @@ def ExpandReferencesInDict( obj, mapping, **kwargs ): for k in obj.keys(): obj[ k ] = expand_refs_in_object( obj[ k ] ) + + +def DisplayBaloon( is_term, display ): + if not is_term: + display = '\n'.join( display ) + + vim.eval( "balloon_show( {0} )".format( + json.dumps( display ) ) ) diff --git a/python3/vimspector/variables.py b/python3/vimspector/variables.py index 7fcb20e..a66bf57 100644 --- a/python3/vimspector/variables.py +++ b/python3/vimspector/variables.py @@ -14,7 +14,6 @@ # limitations under the License. import vim -import json import logging from collections import namedtuple from functools import partial @@ -85,6 +84,7 @@ class VariablesView( object ): self._oldoptions[ 'balloonevalterm' ] = vim.options[ 'balloonevalterm' ] vim.options[ 'balloonevalterm' ] = True + self._is_term = not bool( int( vim.eval( "has( 'gui_running' )" ) ) ) def Clear( self ): with utils.ModifiableScratchBuffer( self._vars.win.buffer ): @@ -356,13 +356,11 @@ class VariablesView( object ): 'Type: ' + body.get( 'type', '' ), 'Value: ' + result ] - vim.eval( "balloon_show( {0} )".format( - json.dumps( display ) ) ) + utils.DisplayBaloon( self._is_term, display ) def failure_handler( reason, message ): display = [ reason ] - vim.eval( "balloon_show( {0} )".format( - json.dumps( display ) ) ) + utils.DisplayBaloon( self._is_term, display ) self._connection.DoRequest( handler, {