     stoppedChangingCallback = =>
       @stoppedChangingTimeout = null
       modifiedStatus = @isModified()
-      @emitter.emit 'did-stop-changing', {changes: Object.freeze(normalizePatchChanges(Patch.composeChanges(@changesSinceLastStoppedChangingEvent)))}
-      @changesSinceLastStoppedChangingEvent = []
+      @emitter.emit 'did-stop-changing', {changes: Object.freeze(normalizePatchChanges(Patch.compose(@patchesSinceLastStoppedChangingEvent)))}
+      @patchesSinceLastStoppedChangingEvent = []
       @emitModifiedStatusChanged(modifiedStatus)
     @stoppedChangingTimeout = setTimeout(stoppedChangingCallback, @stoppedChangingDelay)
 

    text = params if typeof params is 'string'

    @emitter = new Emitter
    @changesSinceLastStoppedChangingEvent = []
    @didChangeTextPatch = new Patch
    @id = params?.id ? crypto.randomBytes(16).toString('hex')
    @lines = ['']

      markerLayer.emitChangeEvents(snapshot?[markerLayerId])

  handleChangedText: ->
    @emitter.emit 'did-change-text', {changes: Object.freeze(normalizePatchChanges(@didChangeTextPatch.getChanges()))}
    @patchesSinceLastStoppedChangingEvent.push(@didChangeTextPatch)
    @didChangeTextPatch = new Patch

  # Identifies if the buffer belongs to multiple editors.
