File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 66import sys
77
88from .decorators import plugin , rpc_export
9- from ..api import Nvim
9+ from ..api import Nvim , walk
1010
1111__all__ = ('ScriptHost' ,)
1212
@@ -161,15 +161,23 @@ def writelines(self, seq):
161161 self .redirect_handler ('\n ' .join (seq ))
162162
163163
164+ if IS_PYTHON3 :
165+ num_types = (int , float )
166+ else :
167+ num_types = (int , long , float )
168+
169+
170+ def num_to_str (obj ):
171+ if isinstance (obj , num_types ):
172+ return str (obj )
173+ else :
174+ return obj
175+
176+
164177class LegacyVim (Nvim ):
165178 def eval (self , expr ):
166179 obj = self .request ("vim_eval" , expr )
167- if IS_PYTHON3 :
168- if isinstance (obj , (int , float )):
169- return str (obj )
170- elif isinstance (obj , (int , long , float )):
171- return str (obj )
172- return obj
180+ return walk (num_to_str , obj )
173181
174182
175183# This was copied/adapted from nvim-python help
You can’t perform that action at this time.
0 commit comments