Skip to content

Commit 8f9eead

Browse files
sharilslpil
authored andcommitted
Fix UltiSnips " trigger closing quote expansion
1 parent 8a03589 commit 8f9eead

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

UltiSnips/python.snippets

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,18 @@ def triple_quotes_handle_trailing(snip, quoting_style):
127127
if not snip.c:
128128
# Do this only once, otherwise the following error would happen:
129129
# RuntimeError: The snippets content did not converge: …
130-
_, col = vim.current.window.cursor
131-
line = vim.current.line
130+
row, col = vim.current.window.cursor
131+
132+
# before ultisnip expansion, chars ahead cursor is at row - 1, col
133+
# after ultisnip expansion, they are pushed to row + 1, col - 1
134+
# when this function is run, it's already after ultisni expansion
135+
line = snip.buffer[row + 1]
132136
133137
# Handle already existing quote chars after the trigger.
134138
_ret = quoting_style * 3
135139
while True:
136140
try:
137-
nextc = line[col]
141+
nextc = line[col - 1]
138142
except IndexError:
139143
break
140144
if nextc == quoting_style and len(_ret):

0 commit comments

Comments
 (0)