mirror of
https://github.com/atom/atom.git
synced 2026-02-10 22:55:09 -05:00
When a snippet expansion is redone, tab stops are restored
This commit is contained in:
@@ -54,3 +54,7 @@ class SnippetExpansion
|
||||
destroy: ->
|
||||
anchorRange.destroy() for anchorRange in @tabStopAnchorRanges
|
||||
@editSession.snippetExpansion = null
|
||||
|
||||
restoreTabStops: ->
|
||||
@tabStopAnchorRanges = @tabStopAnchorRanges.map (anchorRange) =>
|
||||
@editSession.addAnchorRange(anchorRange.getBufferRange())
|
||||
|
||||
@@ -29,9 +29,13 @@ module.exports =
|
||||
prefix = editSession.getLastCursor().getCurrentWordPrefix()
|
||||
if snippet = @snippetsByExtension[editSession.getFileExtension()][prefix]
|
||||
editSession.transact ->
|
||||
editSession.snippetExpansion = new SnippetExpansion(snippet, editSession)
|
||||
snippetExpansion = new SnippetExpansion(snippet, editSession)
|
||||
editSession.snippetExpansion = snippetExpansion
|
||||
editSession.pushOperation
|
||||
undo: -> editSession.snippetExpansion.destroy()
|
||||
redo: ->
|
||||
editSession.snippetExpansion = snippetExpansion
|
||||
snippetExpansion.restoreTabStops()
|
||||
else
|
||||
e.abortKeyBinding()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user