 module.exports =
 class LineMap
   constructor: ->
-    @screenLines = []
+    @lineFragments = []
 
-  insertAtBufferRow: (bufferRow, screenLines) ->
+  insertAtBufferRow: (bufferRow, lineFragments) ->
     delta = new Point
     insertIndex = 0
 
-    for screenLine in @screenLines
-      nextDelta = delta.add(screenLine.bufferDelta)
+    for lineFragment in @lineFragments
+      nextDelta = delta.add(lineFragment.bufferDelta)
       break if nextDelta.row > bufferRow
       delta = nextDelta
       insertIndex++
 
-    @screenLines[insertIndex...insertIndex] = screenLines
+    @lineFragments[insertIndex...insertIndex] = lineFragments
 
-  spliceAtBufferRow: (startRow, rowCount, screenLines) ->
-    @spliceByDelta('bufferDelta', startRow, rowCount, screenLines)
+  spliceAtBufferRow: (startRow, rowCount, lineFragments) ->
+    @spliceByDelta('bufferDelta', startRow, rowCount, lineFragments)
 
-  spliceAtScreenRow: (startRow, rowCount, screenLines) ->
-    @spliceByDelta('screenDelta', startRow, rowCount, screenLines)
+  spliceAtScreenRow: (startRow, rowCount, lineFragments) ->
+    @spliceByDelta('screenDelta', startRow, rowCount, lineFragments)
 
-  spliceByDelta: (deltaType, startRow, rowCount, screenLines) ->
+  spliceByDelta: (deltaType, startRow, rowCount, lineFragments) ->
     stopRow = startRow + rowCount
     startIndex = undefined
     stopIndex = 0
     delta = new Point
 
-    for screenLine, i in @screenLines
+    for lineFragment, i in @lineFragments
       startIndex ?= i if delta.row == startRow
-      nextDelta = delta.add(screenLine[deltaType])
+      nextDelta = delta.add(lineFragment[deltaType])
       break if nextDelta.row > stopRow
       delta = nextDelta
       stopIndex++
 
-    @screenLines[startIndex...stopIndex] = screenLines
+    @lineFragments[startIndex...stopIndex] = lineFragments
 
-  replaceBufferRows: (start, end, screenLines) ->
-    @spliceAtBufferRow(start, end - start + 1, screenLines)
+  replaceBufferRows: (start, end, lineFragments) ->
+    @spliceAtBufferRow(start, end - start + 1, lineFragments)
 
-  replaceScreenRow: (row, screenLines) ->
-    @replaceScreenRows(row, row, screenLines)
+  replaceScreenRow: (row, lineFragments) ->
+    @replaceScreenRows(row, row, lineFragments)
 
-  replaceScreenRows: (start, end, screenLines) ->
-    @spliceAtScreenRow(start, end - start + 1, screenLines)
+  replaceScreenRows: (start, end, lineFragments) ->
+    @spliceAtScreenRow(start, end - start + 1, lineFragments)
 
   lineForScreenRow: (row) ->
     @linesForScreenRows(row, row)[0]

    bufferDelta = new Point
    screenDelta = new Point

    for screenLine in @screenLines
      nextDelta = screenDelta.add(screenLine.screenDelta)
      break if nextDelta.isGreaterThan(screenPosition)
      screenDelta = nextDelta
      bufferDelta = bufferDelta.add(screenLine.bufferDelta)

    column = bufferDelta.column + (screenPosition.column - screenDelta.column)
    new Point(bufferDelta.row, column)

    bufferDelta = new Point
    screenDelta = new Point

    for lineFragment in @lineFragments
      nextDelta = bufferDelta.add(lineFragment.bufferDelta)
      break if nextDelta.isGreaterThan(bufferPosition)
      break if nextDelta.isEqual(bufferPosition) and not eagerWrap
      bufferDelta = nextDelta
      screenDelta = screenDelta.add(lineFragment.screenDelta)

    remainingBufferColumn = bufferPosition.column - bufferDelta.column
    additionalScreenColumn = Math.max(0, Math.min(remainingBufferColumn, lineFragment.lengthForClipping()))

    new Point(screenDelta.row, screenDelta.column + additionalScreenColumn)

