       params?.text
 
     @emitter = new Emitter
+    @patchesSinceLastStoppedChangingEvent = []
     @id = crypto.randomBytes(16).toString('hex')
     @buffer = new NativeTextBuffer(text)
     @debouncedEmitDidStopChangingEvent = debounce(@emitDidStopChangingEvent.bind(this), @stoppedChangingDelay)
     @textDecorationLayers = new Set()
     maxUndoEntries = params?.maxUndoEntries ? @defaultMaxUndoEntries
     @history = new History(this, maxUndoEntries)
-    @lastStoppedChangingCheckpoint = @history.createCheckpoint({})
     @nextMarkerLayerId = 0
     @nextDisplayLayerId = 0
     @defaultMarkerLayer = new MarkerLayer(this, String(@nextMarkerLayerId++))

    return if @destroyed

    modifiedStatus = @isModified()
    composedChanges = @getChangesSinceCheckpoint(@lastStoppedChangingCheckpoint)
    @lastStoppedChangingCheckpoint = @history.createCheckpoint({})
    @emitter.emit(
      'did-stop-changing',
      {changes: Object.freeze(composedChanges)}
    )
    @emitModifiedStatusChanged(modifiedStatus)

  emitModifiedStatusChanged: (modifiedStatus) ->

    hunks = patch.getChanges()
    if hunks.length > 0
      @emitter.emit 'did-change-text', {changes: Object.freeze(normalizePatchChanges(hunks))}
      @patchesSinceLastStoppedChangingEvent.push(patch)
      @debouncedEmitDidStopChangingEvent()

  # Identifies if the buffer belongs to multiple editors.
