diff --git a/src/lines-component.coffee b/src/lines-component.coffee index c2bd8e22a..ad3c221be 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -27,7 +27,7 @@ LinesComponent = React.createClass {scrollWidth, scrollHeight} = @newState {lineHeightInPixels, defaultCharWidth, scrollViewHeight, scopedCharacterWidthsChangeCount} = @props - {scrollTop, scrollLeft, cursorPixelRects} = @props + {cursorPixelRects} = @props style = height: Math.max(scrollHeight, scrollViewHeight) width: scrollWidth @@ -48,7 +48,8 @@ LinesComponent = React.createClass } getTransform: -> - {scrollTop, scrollLeft, useHardwareAcceleration} = @props + {scrollTop, scrollLeft} = @newState + {useHardwareAcceleration} = @props if useHardwareAcceleration "translate3d(#{-scrollLeft}px, #{-scrollTop}px, 0px)" diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index e1d26fa70..d25713447 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -232,6 +232,7 @@ TextEditorComponent = React.createClass clientHeight: editor.getHeight() clientWidth: editor.getWidth() scrollTop: editor.getScrollTop() + scrollLeft: editor.getScrollLeft() lineHeight: editor.getLineHeightInPixels() baseCharacterWidth: editor.getDefaultCharWidth() lineOverdrawMargin: lineOverdrawMargin @@ -393,7 +394,7 @@ TextEditorComponent = React.createClass @subscribe editor.onDidChangeCharacterWidths(@onCharacterWidthsChanged) @subscribe editor.onDidChangePlaceholderText(@onPlaceholderTextChanged) @subscribe editor.$scrollTop.changes, @onScrollTopChanged - @subscribe editor.$scrollLeft.changes, @requestUpdate + @subscribe editor.$scrollLeft.changes, @onScrollLeftChanged @subscribe editor.$verticalScrollbarWidth.changes, @requestUpdate @subscribe editor.$horizontalScrollbarHeight.changes, @requestUpdate @subscribe editor.$height.changes, @requestUpdate @@ -530,6 +531,7 @@ TextEditorComponent = React.createClass unless animationFramePending @requestAnimationFrame => @props.editor.setScrollLeft(@pendingScrollLeft) + @presenter?.setScrollLeft(@pendingScrollLeft) @pendingScrollLeft = null onMouseWheel: (event) -> @@ -725,6 +727,10 @@ TextEditorComponent = React.createClass @onStoppedScrollingAfterDelay ?= debounce(@onStoppedScrolling, 200) @onStoppedScrollingAfterDelay() + onScrollLeftChanged: -> + @presenter?.setScrollLeft(@props.editor.getScrollLeft()) + @requestUpdate() + onStoppedScrolling: -> return unless @isMounted()