   # Public: Get the entire text of the buffer.
   #
   # Returns a {String}.
-  getText: -> @buffer.getText()
+  getText: -> @cachedText ?= @buffer.getText()
 
   # Public: Get the text in a range.
   #

      for id, markerLayer of @markerLayers
        markerLayer.splice(oldRange.start, oldExtent, newExtent)

    @emitDidChangeEvent(changeEvent)
    newRange



    @fileHasChangedSinceLastLoad = false
    @digestWhenLastPersisted = @buffer.baseTextDigest()
    @cachedText = null

    if @loaded and patch.getChangeCount() > 0
      if options?.clearHistory
