 
     @changeCount++
     @stoppedChangingPatch.splice(oldRange.start, oldRange.getExtent(), newRange.getExtent(), text: newText)
-    @didChangeTextPatch ?= new Patch
     @didChangeTextPatch.splice(oldRange.start, oldRange.getExtent(), newRange.getExtent(), text: newText)
     @emitter.emit 'did-change', changeEvent
 

    text = params if typeof params is 'string'

    @emitter = new Emitter
    @stoppedChangingPatch = new Patch(combineChanges: true)
    @id = params?.id ? crypto.randomBytes(16).toString('hex')
    @lines = ['']
    @lineEndings = ['']

      markerLayer.emitChangeEvents(snapshot?[markerLayerId])

  emitChangeTextEvent: ->
    @emitter.emit 'did-change-text', Object.freeze(normalizePatchChanges(@didChangeTextPatch.getChanges()))
    @didChangeTextPatch = new Patch(combineChanges: true, batchMode: true)

  # Identifies if the buffer belongs to multiple editors.
  #
