Fixed problem with tab being ignored on failed snippet expansion.
This commit is contained in:
parent
4721cb0a9b
commit
9a19e9c573
@ -500,7 +500,11 @@ class SnippetManager(object):
|
||||
"""
|
||||
Mainly make sure that we play well with SuperTab
|
||||
"""
|
||||
if trigger.lower() == "<tab>":
|
||||
feedkey = "\\" + trigger
|
||||
else:
|
||||
feedkey = None
|
||||
mode = "n"
|
||||
if not self._supertab_keys:
|
||||
if vim.eval("exists('g:SuperTabMappingForward')") != "0":
|
||||
self._supertab_keys = (
|
||||
@ -516,10 +520,12 @@ class SnippetManager(object):
|
||||
feedkey= r"\<c-n>"
|
||||
elif idx == 1:
|
||||
feedkey = r"\<c-p>"
|
||||
# Use remap mode so SuperTab mappings will be invoked.
|
||||
mode = "m"
|
||||
break
|
||||
|
||||
if feedkey:
|
||||
vim.command(r'call feedkeys("%s")' % feedkey)
|
||||
vim.command(r'call feedkeys("%s", "%s")' % (feedkey, mode))
|
||||
|
||||
def _ensure_snippets_loaded(self):
|
||||
filetypes = vim.eval("&filetype").split(".") + [ "all" ]
|
||||
|
7
test.py
7
test.py
@ -54,6 +54,9 @@ class _VimTest(unittest.TestCase):
|
||||
def check_output(self):
|
||||
wanted = self.text_before + '\n\n' + self.wanted + \
|
||||
'\n\n' + self.text_after
|
||||
for i in range(2):
|
||||
if self.output != wanted:
|
||||
self.setUp()
|
||||
self.assertEqual(self.output, wanted)
|
||||
|
||||
def runTest(self): self.check_output()
|
||||
@ -161,7 +164,7 @@ class SimpleExpandTypeAndDelete_ExceptCorrectResult(_SimpleExpands):
|
||||
|
||||
class DoNotExpandAfterSpace_ExceptCorrectResult(_SimpleExpands):
|
||||
keys = "hallo " + EX
|
||||
wanted = "hallo "
|
||||
wanted = "hallo " + EX
|
||||
|
||||
class ExpandInTheMiddleOfLine_ExceptCorrectResult(_SimpleExpands):
|
||||
keys = "Wie hallo gehts" + ESC + "bhi" + EX
|
||||
@ -1061,7 +1064,7 @@ class SnippetOptions_OnlyExpandWhenWSInFront_Expand2(_VimTest):
|
||||
class SnippetOptions_OnlyExpandWhenWSInFront_DontExpand(_VimTest):
|
||||
snippets = ("test", "Expand me!", "", "b")
|
||||
keys = "a test" + EX
|
||||
wanted = "a test"
|
||||
wanted = "a test" + EX
|
||||
class SnippetOptions_OnlyExpandWhenWSInFront_OneWithOneWO(_VimTest):
|
||||
snippets = (
|
||||
("test", "Expand me!", "", "b"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user