Report the already calculated height to the model

This commit is contained in:
Antonio Scandurra
2015-09-23 11:44:37 +02:00
parent 60fdd3793f
commit abd1b05c65
2 changed files with 6 additions and 14 deletions

View File

@@ -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)

View File

@@ -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