Use vim.bindeval() to avoid Unicode problems

Fixes #690.
This commit is contained in:
Marius Gedminas 2016-09-16 15:03:08 +03:00
parent 97a280417b
commit 2098788e69

10
pythonx/UltiSnips/_vim.py Normal file → Executable file
View File

@ -124,6 +124,14 @@ def eval(text):
return rv
def bindeval(text):
"""Wraps vim.bindeval."""
rv = vim.bindeval(as_vimencoding(text))
if not isinstance(rv, (dict, list)):
return as_unicode(rv)
return rv
def feedkeys(keys, mode='n'):
"""Wrapper around vim's feedkeys function.
@ -242,7 +250,7 @@ def _unmap_select_mode_mapping():
'| redir END')
# Check if any mappings where found
all_maps = list(filter(len, eval(r"_tmp_smaps").splitlines()))
all_maps = list(filter(len, bindeval(r"_tmp_smaps").splitlines()))
if len(all_maps) == 1 and all_maps[0][0] not in ' sv':
# "No maps found". String could be localized. Hopefully
# it doesn't start with any of these letters in any