mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
No longer push empty batches onto undo stack
This commit is contained in:
@@ -136,3 +136,12 @@ describe "UndoManager", ->
|
||||
|
||||
expect(buffer.lineForRow(4)).not.toContain("while")
|
||||
expect(buffer.lineForRow(4)).toContain("slongaz")
|
||||
|
||||
it "does not store empty batches", ->
|
||||
buffer.insert([0,0], "foo")
|
||||
undoManager.startUndoBatch()
|
||||
undoManager.endUndoBatch()
|
||||
|
||||
undoManager.undo()
|
||||
expect(buffer.lineForRow(0)).not.toContain("foo")
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class UndoManager
|
||||
|
||||
endUndoBatch: (ranges) ->
|
||||
@currentBatch.newSelectionRanges = ranges
|
||||
@undoHistory.push(@currentBatch)
|
||||
@undoHistory.push(@currentBatch) if @currentBatch.length > 0
|
||||
@currentBatch = null
|
||||
|
||||
preservingHistory: (fn) ->
|
||||
|
||||
Reference in New Issue
Block a user