atom / snippets

Atom snippets package
MIT License
205 stars 100 forks source link

Undoing snippets leaks snippet tab stops at ends #261

Closed Ingramz closed 5 years ago

Ingramz commented 6 years ago

This is taken from #239

Consider these two snippets:

    prefix: "bug1"
    body: "$1expanded$0"
    prefix: "bug2"
    body: "$0expanded$1"

To reproduce the leakage, do: Type bug1 -> hit tab to expand snippet -> undo -> hit tab to expand snippet again -> hit tab again because it didn't work the first time: undo did not delete the tab stop at $0 from the first time.

A more obvious version of this is the same, but with bug2: Type bug2 -> hit tab to expand snippet -> undo -> hit tab to expand snippet again: cursor jumps to the beginning of the prefix.

Pinging @nathansobo @savetheclocktower due to possible relevance from #260 wanting to improve on undo/redo. I thought this should be looked into while at it.

50Wliu commented 6 years ago

Seems related to #248.

nathansobo commented 6 years ago

Put this on the triage board for discussion.

Aerijo commented 5 years ago

Is this still an issue? I wasn't able to reproduce either example. In the first, the cursor jumped to the start both times, and in the second it stayed at the end.

Ingramz commented 5 years ago

I am unable to reproduce this either anymore. Thanks for noticing, @Aerijo!

Closing the issue.

Ingramz commented 5 years ago

I shall also review whether we have a good regression test for this, so that it wouldn't happen again.