From 6d6fe9dbb6bb29bd49301ecd75a3b764500543b0 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Sun, 12 Feb 2012 08:14:21 +0100 Subject: [PATCH] Fixed a bug when tabstop zero was deleted and then a jump attemted --- plugin/UltiSnips/text_objects/_snippet_instance.py | 2 +- test.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/UltiSnips/text_objects/_snippet_instance.py b/plugin/UltiSnips/text_objects/_snippet_instance.py index bc080fd..cad13ad 100755 --- a/plugin/UltiSnips/text_objects/_snippet_instance.py +++ b/plugin/UltiSnips/text_objects/_snippet_instance.py @@ -93,7 +93,7 @@ class SnippetInstance(EditableTextObject): res = self._get_next_tab(self._cts) if res is None: self._cts = None - return self._tabstops[0] + return self._tabstops.get(0, None) else: self._cts, ts = res return ts diff --git a/test.py b/test.py index d4dd985..0b192ce 100755 --- a/test.py +++ b/test.py @@ -2546,10 +2546,14 @@ class JumpForward_DefSnippet(_VimTest): snippets = ("test", "${1}\n`!p snip.rv = '\\n'.join(t[1].split())`\n\n${0:pass}") keys = "test" + EX + "a b c" + JF + "shallnot" + JF + "end" wanted = "a b c\na\nb\nc\n\nshallnotend" -class DeleteSnippetInsertion(_VimTest): +class DeleteSnippetInsertion0(_VimTest): snippets = ("test", "${1:hello} $1") keys = "test" + EX + ESC + "Vkx" + "i\nworld\n" wanted = "world" +class DeleteSnippetInsertion1(_VimTest): + snippets = ("test", r"$1${1/(.*)/(?0::.)/}") + keys = "test" + EX + ESC + "u" + "i" + JF + "\t" + wanted = "\t" # End: Undo of Snippet insertion #}}} # Tab Completion of Words {{{#