From f4515daeee74ca660cff8ba3643f0b6eba675897 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Sun, 9 Aug 2009 15:00:20 +0200 Subject: [PATCH] Fixed bug 411010 --- plugin/UltiSnips/__init__.py | 19 ++++++++++++------- test.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/plugin/UltiSnips/__init__.py b/plugin/UltiSnips/__init__.py index 71db6fa..473e9f2 100644 --- a/plugin/UltiSnips/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -476,13 +476,18 @@ class SnippetManager(object): ] ) - rv = vim.eval("inputlist(%s)" % display) - if rv is None or rv == '0': - return True - rv = int(rv) - if rv > len(snippets): - rv = len(snippets) - snippet = snippets[rv-1] + try: + rv = vim.eval("inputlist(%s)" % display) + if rv is None or rv == '0': + return True + rv = int(rv) + if rv > len(snippets): + rv = len(snippets) + snippet = snippets[rv-1] + except vim.error, e: + if str(e) == 'invalid expression': + return True + raise self._expect_move_wo_change = True diff --git a/test.py b/test.py index dcaefdd..da95a5c 100755 --- a/test.py +++ b/test.py @@ -1096,6 +1096,41 @@ class Multiple_SimpleCaseSelectZero_EEscape(_MultipleMatches): class Multiple_SimpleCaseEscapeOut_ECR(_MultipleMatches): keys = "test" + EX + ESC + "hi" wanted = "testhi" +class Multiple_ManySnippetsOneTrigger_ECR(_VimTest): + # Snippet definition {{{ + snippets = ( + ("test", "Case1", "This is Case 1"), + ("test", "Case2", "This is Case 2"), + ("test", "Case3", "This is Case 3"), + ("test", "Case4", "This is Case 4"), + ("test", "Case5", "This is Case 5"), + ("test", "Case6", "This is Case 6"), + ("test", "Case7", "This is Case 7"), + ("test", "Case8", "This is Case 8"), + ("test", "Case9", "This is Case 9"), + ("test", "Case10", "This is Case 10"), + ("test", "Case11", "This is Case 11"), + ("test", "Case12", "This is Case 12"), + ("test", "Case13", "This is Case 13"), + ("test", "Case14", "This is Case 14"), + ("test", "Case15", "This is Case 15"), + ("test", "Case16", "This is Case 16"), + ("test", "Case17", "This is Case 17"), + ("test", "Case18", "This is Case 18"), + ("test", "Case19", "This is Case 19"), + ("test", "Case20", "This is Case 20"), + ("test", "Case21", "This is Case 21"), + ("test", "Case22", "This is Case 22"), + ("test", "Case23", "This is Case 23"), + ("test", "Case24", "This is Case 24"), + ("test", "Case25", "This is Case 25"), + ("test", "Case26", "This is Case 26"), + ("test", "Case27", "This is Case 27"), + ("test", "Case28", "This is Case 28"), + ("test", "Case29", "This is Case 29"), + ) # }}} + keys = "test" + EX + ESC + ESC + "ahi" + wanted = "testhi" ########################################################################### # END OF TEST #