From 2098788e69dc1160e7c8d96ea64de8c0ab590d83 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Fri, 16 Sep 2016 15:03:08 +0300 Subject: [PATCH] Use vim.bindeval() to avoid Unicode problems Fixes #690. --- pythonx/UltiSnips/_vim.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) mode change 100644 => 100755 pythonx/UltiSnips/_vim.py diff --git a/pythonx/UltiSnips/_vim.py b/pythonx/UltiSnips/_vim.py old mode 100644 new mode 100755 index 1b0f752..6cd45e6 --- a/pythonx/UltiSnips/_vim.py +++ b/pythonx/UltiSnips/_vim.py @@ -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