Gracefully handle the case when there is no screenline

This commit is contained in:
Ben Ogle 2014-09-03 16:00:57 -07:00
parent 523a255e48
commit b90670ff2d
2 changed files with 2 additions and 1 deletions

View File

@ -2777,6 +2777,7 @@ describe "Editor", ->
it '.lineTextForScreenRow(row)', ->
editor.foldBufferRow(4)
expect(editor.lineTextForScreenRow(5)).toEqual ' return sort(left).concat(pivot).concat(sort(right));'
expect(editor.lineTextForScreenRow(100)).not.toBeDefined()
describe ".deleteLine()", ->
it "deletes the first line when the cursor is there", ->

View File

@ -422,7 +422,7 @@ class Editor extends Model
# given screen row.
#
# * `screenRow` A {Number} representing a zero-indexed screen row.
lineTextForScreenRow: (screenRow) -> @displayBuffer.tokenizedLineForScreenRow(screenRow).text
lineTextForScreenRow: (screenRow) -> @displayBuffer.tokenizedLineForScreenRow(screenRow)?.text
# Gets the screen line for the given screen row.
#