Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid changing 'undolevels' when creating an undo break. #1534

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pythonx/UltiSnips/snippet_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def __init__(self, expand_trigger, forward_trigger, backward_trigger):
def jump_forwards(self):
"""Jumps to the next tabstop."""
vim_helper.command("let g:ulti_jump_forwards_res = 1")
vim_helper.command("let &undolevels = &undolevels")
vim_helper.command("let &g:undolevels = &g:undolevels")
if not self._jump(JumpDirection.FORWARD):
vim_helper.command("let g:ulti_jump_forwards_res = 0")
return self._handle_failure(self.forward_trigger)
Expand All @@ -165,7 +165,7 @@ def jump_forwards(self):
def jump_backwards(self):
"""Jumps to the previous tabstop."""
vim_helper.command("let g:ulti_jump_backwards_res = 1")
vim_helper.command("let &undolevels = &undolevels")
vim_helper.command("let &g:undolevels = &g:undolevels")
if not self._jump(JumpDirection.BACKWARD):
vim_helper.command("let g:ulti_jump_backwards_res = 0")
return self._handle_failure(self.backward_trigger)
Expand Down Expand Up @@ -808,15 +808,15 @@ def _try_expand(self, autotrigger_only=False):
if not snippets:
# No snippet found
return False
vim_helper.command("let &undolevels = &undolevels")
vim_helper.command("let &g:undolevels = &g:undolevels")
if len(snippets) == 1:
snippet = snippets[0]
else:
snippet = _ask_snippets(snippets)
if not snippet:
return True
self._do_snippet(snippet, before)
vim_helper.command("let &undolevels = &undolevels")
vim_helper.command("let &g:undolevels = &g:undolevels")
return True

def can_expand(self, autotrigger_only=False):
Expand Down
Loading