Comment 11 for bug 1251994

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

I had some time to look into the problem again and I think I have found both the source of the problem and a solution. The reason why cursor moves left and then right after jumping to the second tab stop is because of the select() function from _vim.py. This function leaves insert mode and then visually selects the placeholder text of the second tab stop. It is smart enough to understand that leaving insert mode via "Esc" moves the cursor one character left, so it immediately moves it right to compensate. Unfortunately, these motions do not "cancel", and both trigger CursorMoved events, which consequently trigger `SnippetsManager.cursor_moved()` function which decides that the snippet is done.

I have submitted a pull request on github: https://github.com/SirVer/ultisnips/pull/120