Move undo/redo to EditSession

This commit is contained in:
Nathan Sobo
2012-06-12 13:40:18 -06:00
parent 7b64066bf4
commit a71ee63906
2 changed files with 10 additions and 8 deletions

View File

@@ -167,6 +167,14 @@ class EditSession
pasteText: ->
@insertText($native.readFromPasteboard())
undo: ->
if ranges = @buffer.undo()
@setSelectedBufferRanges(ranges)
redo: ->
if ranges = @buffer.redo()
@setSelectedBufferRanges(ranges)
foldSelection: ->
selection.fold() for selection in @getSelections()

View File

@@ -749,18 +749,12 @@ class Editor extends View
scanInRange: (args...) -> @buffer.scanInRange(args...)
backwardsScanInRange: (args...) -> @buffer.backwardsScanInRange(args...)
cutSelection: -> @activeEditSession.cutSelectedText()
copySelection: -> @activeEditSession.copySelectedText()
paste: -> @activeEditSession.pasteText()
undo: ->
if ranges = @buffer.undo()
@setSelectedBufferRanges(ranges)
redo: ->
if ranges = @buffer.redo()
@setSelectedBufferRanges(ranges)
undo: -> @activeEditSession.undo()
redo: -> @activeEditSession.redo()
destroyFold: (foldId) ->
fold = @renderer.foldsById[foldId]