mirror of
https://github.com/atom/atom.git
synced 2026-02-13 16:14:59 -05:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user