Revert "moving PythonToVimStr to before _catch_exception"

This reverts commit 320809c211.
This commit is contained in:
Stephen J. Fuhry
2013-09-08 14:07:29 -04:00
parent 320809c211
commit f405ce625a

View File

@@ -34,27 +34,6 @@ class VimError(Exception):
return self.message + '; created by: ' + repr(self.executing)
class PythonToVimStr(unicode):
""" Vim has a different string implementation of single quotes """
__slots__ = []
def __new__(cls, obj, encoding='UTF-8'):
if is_py3k or isinstance(obj, unicode):
return unicode.__new__(cls, obj)
else:
return unicode.__new__(cls, obj, encoding)
def __repr__(self):
# this is totally stupid and makes no sense but vim/python unicode
# support is pretty bad. don't ask how I came up with this... It just
# works...
# It seems to be related to that bug: http://bugs.python.org/issue5876
if unicode is str:
s = self
else:
s = self.encode('UTF-8')
return '"%s"' % s.replace('\\', '\\\\').replace('"', r'\"')
def _catch_exception(string, is_eval):
"""
Interface between vim and python calls back to it.
@@ -83,6 +62,27 @@ if not hasattr(jedi, '__version__') or jedi.__version__ < (0, 7, 0):
echo_highlight('Please update your Jedi version, it is to old.')
class PythonToVimStr(unicode):
""" Vim has a different string implementation of single quotes """
__slots__ = []
def __new__(cls, obj, encoding='UTF-8'):
if is_py3k or isinstance(obj, unicode):
return unicode.__new__(cls, obj)
else:
return unicode.__new__(cls, obj, encoding)
def __repr__(self):
# this is totally stupid and makes no sense but vim/python unicode
# support is pretty bad. don't ask how I came up with this... It just
# works...
# It seems to be related to that bug: http://bugs.python.org/issue5876
if unicode is str:
s = self
else:
s = self.encode('UTF-8')
return '"%s"' % s.replace('\\', '\\\\').replace('"', r'\"')
@catch_and_print_exceptions
def get_script(source=None, column=None):
jedi.settings.additional_dynamic_modules = [b.name for b in vim.buffers