Merge pull request #603 from seletskiy/do-not-break-last-jump-on-post-expand

fix last jump $0 placeholder using post_expand
This commit is contained in:
Holger Rapp 2015-11-07 14:17:06 +01:00
commit ef72df8e78
2 changed files with 23 additions and 1 deletions

View File

@ -205,7 +205,7 @@ class VimBufferProxy(_vim.VimBuffer):
else:
if line_number > self._snippets_stack[0]._end.line:
return
if column_number > self._snippets_stack[0]._end.col:
if column_number >= self._snippets_stack[0]._end.col:
return
self._snippets_stack[0]._do_edit(change)

View File

@ -346,3 +346,25 @@ c2
c3
c0
a0"""
class SnippetActions_PostActionModifiesCharAfterSnippet(_VimTest):
files = { 'us/all.snippets': r"""
post_expand "snip.buffer[snip.snippet_end[0]] = snip.buffer[snip.snippet_end[0]][:-1]"
snippet a "desc" i
($1)
endsnippet
"""}
keys = '[]' + ARR_L + 'a' + EX + '1' + JF + '2'
wanted = '[(1)2'
class SnippetActions_PostActionModifiesLineAfterSnippet(_VimTest):
files = { 'us/all.snippets': r"""
post_expand "snip.buffer[snip.snippet_end[0]+1:snip.snippet_end[0]+2] = []"
snippet a "desc"
1: $1
$0
endsnippet
"""}
keys = '\n3' + ARR_U + 'a' + EX + '1' + JF + '2'
wanted = '1: 1\n2'