From 88812831ce248315f908fe048d0bd38a8d81d86e Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Jun 2015 23:40:56 +0200 Subject: [PATCH] Only check for max line length when lines exist --- src/display-buffer.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 910f7b177..2519fa6d6 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -483,11 +483,11 @@ class DisplayBuffer extends Model # Returns {TokenizedLine} tokenizedLineForScreenRow: (screenRow) -> if @largeFileMode - line = @tokenizedBuffer.tokenizedLineForRow(screenRow) - if line.text.length > @maxLineLength - @maxLineLength = line.text.length - @longestScreenRow = screenRow - line + if line = @tokenizedBuffer.tokenizedLineForRow(screenRow) + if line.text.length > @maxLineLength + @maxLineLength = line.text.length + @longestScreenRow = screenRow + line else @screenLines[screenRow]