fix last jump $0 placeholder using post_expand
Last jump didn't work when post_expand action modifies char next to snippet end.
This commit is contained in:
parent
c9699feed1
commit
6ea78e525c
@ -205,7 +205,7 @@ class VimBufferProxy(_vim.VimBuffer):
|
|||||||
else:
|
else:
|
||||||
if line_number > self._snippets_stack[0]._end.line:
|
if line_number > self._snippets_stack[0]._end.line:
|
||||||
return
|
return
|
||||||
if column_number > self._snippets_stack[0]._end.col:
|
if column_number >= self._snippets_stack[0]._end.col:
|
||||||
return
|
return
|
||||||
self._snippets_stack[0]._do_edit(change)
|
self._snippets_stack[0]._do_edit(change)
|
||||||
|
|
||||||
|
@ -346,3 +346,25 @@ c2
|
|||||||
c3
|
c3
|
||||||
c0
|
c0
|
||||||
a0"""
|
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'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user