Fix balloons in the GUI

This commit is contained in:
Ben Jackson 2019-02-15 13:19:13 +00:00
commit c684fa0cbb
2 changed files with 11 additions and 5 deletions

View file

@ -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 ) ) )

View file

@ -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', '<unknown>' ),
'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, {