diff --git a/pythonx/UltiSnips/snippet/definition/base.py b/pythonx/UltiSnips/snippet/definition/base.py index 734282d6..2f870602 100644 --- a/pythonx/UltiSnips/snippet/definition/base.py +++ b/pythonx/UltiSnips/snippet/definition/base.py @@ -13,6 +13,7 @@ from UltiSnips.indent_util import IndentUtil from UltiSnips.text import escape from UltiSnips.text_objects import SnippetInstance +from UltiSnips.position import Position from UltiSnips.text_objects.python_code import SnippetUtilForAction __WHITESPACE_SPLIT = re.compile(r"\s") @@ -200,7 +201,9 @@ def _execute_action(self, action, context, additional_locals={}): snip = self._eval_code(action, locals) if snip.cursor.is_set(): - vim.current.window.cursor = snip.cursor.to_vim_cursor() + vim_helper.buf.cursor = Position( + snip.cursor._cursor[0], snip.cursor._cursor[1] + ) else: new_mark_pos = vim_helper.get_mark_pos(mark_to_use) diff --git a/pythonx/UltiSnips/snippet_manager.py b/pythonx/UltiSnips/snippet_manager.py index c4c1fa18..9e443e87 100644 --- a/pythonx/UltiSnips/snippet_manager.py +++ b/pythonx/UltiSnips/snippet_manager.py @@ -89,7 +89,7 @@ def __init__(self, expand_trigger, forward_trigger, backward_trigger): self._snip_expanded_in_action = False self._inside_action = False - self._last_change = ("", 0) + self._last_change = ("", Position(-1, -1)) self._added_snippets_source = AddedSnippetsSource() self.register_snippet_source("ultisnips_files", UltiSnipsFileSource()) @@ -905,11 +905,11 @@ def _track_change(self): if ( before and before[-1] == self._last_change[0] - or self._last_change[1] != vim.current.window.cursor[0] + or self._last_change[1] != vim_helper.buf.cursor ): self._try_expand(autotrigger_only=True) finally: - self._last_change = (inserted_char, vim.current.window.cursor[0]) + self._last_change = (inserted_char, vim_helper.buf.cursor) if self._should_reset_visual and self._visual_content.mode == "": self._visual_content.reset() diff --git a/pythonx/UltiSnips/vim_helper.py b/pythonx/UltiSnips/vim_helper.py index e7a9fc00..8204d18d 100755 --- a/pythonx/UltiSnips/vim_helper.py +++ b/pythonx/UltiSnips/vim_helper.py @@ -197,7 +197,7 @@ def select(start, end): selection = eval("&selection") col = col2byte(start.line + 1, start.col) - vim.current.window.cursor = start.line + 1, col + buf.cursor = start mode = eval("mode()")