Restore markers before triggering buffer events

This allows folds to be restored on undo/redo
This commit is contained in:
Nathan Sobo
2013-04-30 18:21:37 -06:00
parent af903f6690
commit df08c14aef
2 changed files with 13 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ class BufferChangeOperation
@options ?= {}
do: ->
@buffer.pauseEvents()
@pauseMarkerObservation()
@oldText = @buffer.getTextInRange(@oldRange)
@newRange = @calculateNewRange(@oldRange, @newText)
@@ -29,10 +30,12 @@ class BufferChangeOperation
oldText: @oldText
newText: @newText
@restoreMarkers(@markersToRestoreOnRedo) if @markersToRestoreOnRedo
@buffer.resumeEvents()
@resumeMarkerObservation()
newRange
undo: ->
@buffer.pauseEvents()
@pauseMarkerObservation()
@markersToRestoreOnRedo = @invalidateMarkers(@newRange)
@changeBuffer
@@ -41,6 +44,7 @@ class BufferChangeOperation
oldText: @newText
newText: @oldText
@restoreMarkers(@markersToRestoreOnUndo)
@buffer.resumeEvents()
@resumeMarkerObservation()
splitLines: (text) ->