From f103e72c01c841b1c0b2a42da7a30bf98f9034e0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 4 Jun 2014 21:05:29 +0900 Subject: [PATCH] Remove exceptions related to unassigned lineHeight These exceptions break specs when simulateDomAttachment is used. They were only present to ensure correct sequencing during development of the react editor, so it's safe to remove them for now. --- src/display-buffer.coffee | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 579863ec2..36c64863b 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -228,8 +228,7 @@ class DisplayBuffer extends Model @charWidthsByScope = {} getScrollHeight: -> - unless @getLineHeightInPixels() > 0 - throw new Error("You must assign lineHeightInPixels before calling ::getScrollHeight()") + return 0 unless @getLineHeightInPixels() > 0 @getLineCount() * @getLineHeightInPixels() @@ -237,8 +236,7 @@ class DisplayBuffer extends Model (@getMaxLineLength() * @getDefaultCharWidth()) + @getCursorWidth() getVisibleRowRange: -> - unless @getLineHeightInPixels() > 0 - throw new Error("You must assign a non-zero lineHeightInPixels before calling ::getVisibleRowRange()") + return [0, 0] unless @getLineHeightInPixels() > 0 heightInLines = Math.ceil(@getHeight() / @getLineHeightInPixels()) + 1 startRow = Math.floor(@getScrollTop() / @getLineHeightInPixels())