From cf958ffeac6ac01345a8ab6855688aacfb62b2ec Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 11 Feb 2015 22:34:42 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20cascade=20computed=20values=20u?= =?UTF-8?q?nless=20upstream=20values=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/text-editor-presenter.coffee | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index c426631a9..c96668445 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -361,14 +361,18 @@ class TextEditorPresenter Math.max(contentHeight, @height) updateContentWidth: -> - @contentWidth = @pixelPositionForScreenPosition([@model.getLongestScreenRow(), Infinity]).left - @contentWidth += 1 unless @model.isSoftWrapped() # account for cursor width - @updateScrollbarDimensions() + contentWidth = @pixelPositionForScreenPosition([@model.getLongestScreenRow(), Infinity]).left + contentWidth += 1 unless @model.isSoftWrapped() # account for cursor width + unless @contentWidth is contentWidth + @contentWidth = contentWidth + @updateScrollbarDimensions() updateContentHeight: -> - @contentHeight = @lineHeight * @model.getScreenLineCount() - @updateHeight() - @updateScrollbarDimensions() + contentHeight = @lineHeight * @model.getScreenLineCount() + unless @contentHeight is contentHeight + @contentHeight = contentHeight + @updateHeight() + @updateScrollbarDimensions() computeClientHeight: -> @height - @horizontalScrollbarHeight @@ -528,8 +532,10 @@ class TextEditorPresenter @updateLineNumbersState() updateHeight: -> - @height = @explicitHeight ? @contentHeight - @updateScrollbarDimensions() + height = @explicitHeight ? @contentHeight + unless @height is height + @height = height + @updateScrollbarDimensions() setContentFrameWidth: (contentFrameWidth) -> unless @contentFrameWidth is contentFrameWidth