Redoing a snippet expansion restores tab stops to the *current* edit session

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-07-06 12:12:14 -07:00
parent d6912c5913
commit 478a334b73
3 changed files with 18 additions and 5 deletions

View File

@@ -55,6 +55,7 @@ class SnippetExpansion
anchorRange.destroy() for anchorRange in @tabStopAnchorRanges
@editSession.snippetExpansion = null
restoreTabStops: ->
restore: (@editSession) ->
@editSession.snippetExpansion = this
@tabStopAnchorRanges = @tabStopAnchorRanges.map (anchorRange) =>
@editSession.addAnchorRange(anchorRange.getBufferRange())

View File

@@ -32,10 +32,8 @@ module.exports =
snippetExpansion = new SnippetExpansion(snippet, editSession)
editSession.snippetExpansion = snippetExpansion
editSession.pushOperation
undo: -> editSession.snippetExpansion.destroy()
redo: ->
editSession.snippetExpansion = snippetExpansion
snippetExpansion.restoreTabStops()
undo: -> snippetExpansion.destroy()
redo: (editSession) -> snippetExpansion.restore(editSession)
else
e.abortKeyBinding()