Comment 9 for bug 1251994

Revision history for this message
Sergey Alexandrov (alexandrov88) wrote :

Turns out the bug does not have anything to do with mirrors. This simplified version also fails:

snippet test "Test snippet" !b
${2:#2} ${1:#1};$0
endsnippet

I tried to track down the bug, but apparently I do not have a good understanding of the ins and outs of the plugin. What I found is that after entering text in the first tabstop and pressing Tab the cursor jumps to the second tabstop, but then two spurious calls to `SnippetsManager.cursor_moved()` occur, one of them indicating that the cursor moved 1 character to the left, another one that the cursor moved 1 character to the right. That is why indentation matters. When there is no indentation (i.e. we are in the beginning of the line), the spurious left motion has no effect and the cursor does not actually leave the snippet "territory". When there is indentation, the cursor moves out of the snippet therefore finishing it. Unfortunately, I have no clue why these motions happen...