From abd1b05c65df1b058f2715221be5ae7701ac98b2 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 23 Sep 2015 11:44:37 +0200 Subject: [PATCH] Report the already calculated height to the model --- src/display-buffer.coffee | 16 ++++------------ src/text-editor-presenter.coffee | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index ec2dc63b4..2e94307b6 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -200,21 +200,13 @@ class DisplayBuffer extends Model setVerticalScrollbarWidth: (@verticalScrollbarWidth) -> @verticalScrollbarWidth getHeight: -> - if @height? - @height - else - if @horizontallyScrollable() - @getScrollHeight() + @getHorizontalScrollbarHeight() - else - @getScrollHeight() + @height or 0 - setHeight: (@height) -> @height + setHeight: (@height) -> + @height getClientHeight: (reentrant) -> - if @horizontallyScrollable(reentrant) - @getHeight() - @getHorizontalScrollbarHeight() - else - @getHeight() + @getHeight() getClientWidth: (reentrant) -> if @verticallyScrollable(reentrant) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 3bba67275..c999b51de 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -50,7 +50,7 @@ class TextEditorPresenter @emitter.emit "did-update-state" if @isBatching() transferMeasurementsToModel: -> - @model.setHeight(@explicitHeight) if @explicitHeight? + # @model.setHeight(@explicitHeight) if @explicitHeight? @model.setWidth(@contentFrameWidth) if @contentFrameWidth? @model.setLineHeightInPixels(@lineHeight) if @lineHeight? @model.setDefaultCharWidth(@baseCharacterWidth) if @baseCharacterWidth? @@ -688,6 +688,7 @@ class TextEditorPresenter clientHeight = @height - @horizontalScrollbarHeight unless @clientHeight is clientHeight @clientHeight = clientHeight + @model.setHeight(@clientHeight) @updateScrollHeight() @updateScrollTop() @@ -919,7 +920,6 @@ class TextEditorPresenter setExplicitHeight: (explicitHeight) -> unless @explicitHeight is explicitHeight @explicitHeight = explicitHeight - @model.setHeight(explicitHeight) @updateHeight() @shouldUpdateVerticalScrollState = true @shouldUpdateScrollbarsState = true