From 69574e77607d4dcecf0d705449b31540c41c0221 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Fri, 20 Jan 2017 14:13:05 +0700 Subject: [PATCH] address issue #691: ignore non-unicode at all --- pythonx/UltiSnips/snippet_manager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pythonx/UltiSnips/snippet_manager.py b/pythonx/UltiSnips/snippet_manager.py index c11785f..92553ea 100644 --- a/pythonx/UltiSnips/snippet_manager.py +++ b/pythonx/UltiSnips/snippet_manager.py @@ -835,15 +835,17 @@ class SnippetManager(object): def _track_change(self): self._should_update_textobjects = True - inserted_char = _vim.eval('v:char') + inserted_char = _vim.as_unicode(_vim.eval('v:char')) + if not isinstance(inserted_char, unicode): + return + try: if inserted_char == '': before = _vim.buf.line_till_cursor - if before and \ - before[-1].encode('ascii') == self._last_change[0] or \ + + if before and before[-1] == self._last_change[0] or \ self._last_change[1] != vim.current.window.cursor[0]: self._try_expand(autotrigger_only=True) - finally: self._last_change = (inserted_char, vim.current.window.cursor[0])