From bf9428aa198caaa2f599063cb6e458c93b29d217 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 21 Jan 2015 10:16:51 -0700 Subject: [PATCH] Read scrollWidth from the presenter state when rendering --- src/lines-component.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 9ed77f87f..4b233c55d 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -21,7 +21,12 @@ LinesComponent = React.createClass {performedInitialMeasurement, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props if performedInitialMeasurement - {editor, overlayDecorations, highlightDecorations, scrollHeight, scrollWidth, placeholderText, backgroundColor} = @props + {editor, presenter, overlayDecorations, highlightDecorations, scrollHeight, placeholderText, backgroundColor} = @props + + @newState = presenter.state.content + @oldState ?= {lines: {}} + + {scrollWidth} = @newState {lineHeightInPixels, defaultCharWidth, scrollViewHeight, scopedCharacterWidthsChangeCount} = @props {scrollTop, scrollLeft, cursorPixelRects} = @props style = @@ -100,10 +105,6 @@ LinesComponent = React.createClass updateLineNodes: -> {presenter, lineDecorations, mouseWheelScreenRow} = @props - return unless @newState = presenter?.state.content - - @oldState ?= {lines: {}} - @lineNodesByLineId ?= {} for id of @oldState.lines unless @newState.lines.hasOwnProperty(id) or mouseWheelScreenRow is @screenRowsByLineId[id]