     lineEndings.push('')
     normalizedNewText += lastLine
 
+    newExtent = Point(lines.length - 1, lastLine.length)
+    newRange = Range(start, start.traverse(newExtent))
+    newRange.freeze()
+
+    if pushToHistory
+      change.newExtent ?= newExtent
+      @history?.pushChange(change)
+
     newText = normalizedNewText
     changeEvent = Object.freeze({oldRange, newRange, oldText, newText})
     for id, displayLayer of @displayLayers


    oldRange = @clipRange(range)
    oldText = @getTextInRange(oldRange)
    newRange = Range.fromText(oldRange.start, newText)
    change = {newStart: oldRange.start, oldExtent: oldRange.getExtent(), newExtent: newRange.getExtent(), oldText, newText, normalizeLineEndings}
    @history?.pushChange(change) if undo isnt 'skip'
    @applyChange(change)
    newRange

  # Public: Insert text at the given position.
  #

    @insert(@getEndPosition(), text, options)

  # Applies a change to the buffer based on its old range and new text.
  applyChange: (change, pushToHistory = false) ->
    {newStart, oldExtent, oldText, newText, normalizeLineEndings} = change
    @cachedText = null

    start = Point.fromObject(newStart)
    oldRange = Range(start, start.traverse(oldExtent))
    oldRange.freeze()
    startRow = oldRange.start.row
    endRow = oldRange.end.row
    rowCount = endRow - startRow + 1
