Suppress merging selections during undo/redo

Now, during undo/redo overlapping selections will be temporarily
created as markers are created via snapshots. Old selections will
immediately be destroyed though, since undo/redo now completely
replace all historied markers w/ those in the snapshot, so there
is no need to merge selections.
This commit is contained in:
Max Brunsfeld
2015-08-25 10:51:45 -07:00
parent b8aec9db7c
commit f57da0c6f8
2 changed files with 62 additions and 2 deletions

View File

@@ -1119,12 +1119,12 @@ class TextEditor extends Model
# Essential: Undo the last change.
undo: ->
@buffer.undo()
@avoidMergingSelections => @buffer.undo()
@getLastSelection().autoscroll()
# Essential: Redo the last change.
redo: ->
@buffer.redo(this)
@avoidMergingSelections => @buffer.redo()
@getLastSelection().autoscroll()
# Extended: Batch multiple operations as a single undo/redo step.
@@ -2217,6 +2217,9 @@ class TextEditor extends Model
previousSelection.intersectsScreenRowRange(screenRange.start.row, screenRange.end.row)
avoidMergingSelections: (args...) ->
@mergeSelections args..., -> false
mergeSelections: (args...) ->
mergePredicate = args.pop()
fn = args.pop() if _.isFunction(_.last(args))