mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Update the gutter if the scrollTop has changed
This commit is contained in:
@@ -22,12 +22,13 @@ EditorCompont = React.createClass
|
||||
{focused, fontSize, lineHeight, fontFamily, showIndentGuide} = @state
|
||||
{editor, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
|
||||
visibleRowRange = @getVisibleRowRange()
|
||||
scrollTop = editor.getScrollTop()
|
||||
|
||||
className = 'editor react'
|
||||
className += ' is-focused' if focused
|
||||
|
||||
div className: className, style: {fontSize, lineHeight, fontFamily}, tabIndex: -1, onFocus: @onFocus,
|
||||
GutterComponent({editor, visibleRowRange})
|
||||
GutterComponent({editor, visibleRowRange, scrollTop})
|
||||
|
||||
EditorScrollViewComponent {
|
||||
ref: 'scrollView', editor, visibleRowRange, @onInputFocused, @onInputBlurred
|
||||
|
||||
@@ -9,7 +9,7 @@ GutterComponent = React.createClass
|
||||
mixins: [SubscriberMixin]
|
||||
|
||||
render: ->
|
||||
{editor, visibleRowRange} = @props
|
||||
{editor, visibleRowRange, scrollTop} = @props
|
||||
[startRow, endRow] = visibleRowRange
|
||||
lineHeightInPixels = editor.getLineHeight()
|
||||
precedingHeight = startRow * lineHeightInPixels
|
||||
@@ -17,7 +17,7 @@ GutterComponent = React.createClass
|
||||
maxDigits = editor.getLastBufferRow().toString().length
|
||||
style =
|
||||
height: editor.getScrollHeight()
|
||||
WebkitTransform: "translateY(#{-editor.getScrollTop()}px)"
|
||||
WebkitTransform: "translateY(#{-scrollTop}px)"
|
||||
wrapCount = 0
|
||||
|
||||
lineNumbers = []
|
||||
@@ -52,8 +52,9 @@ GutterComponent = React.createClass
|
||||
# non-zero-delta change to the screen lines has occurred within the current
|
||||
# visible row range.
|
||||
shouldComponentUpdate: (newProps) ->
|
||||
{visibleRowRange} = @props
|
||||
{visibleRowRange, scrollTop} = @props
|
||||
|
||||
return true unless newProps.scrollTop is scrollTop
|
||||
return true unless isEqual(newProps.visibleRowRange, visibleRowRange)
|
||||
|
||||
for change in @pendingChanges when change.screenDelta > 0 or change.bufferDelta > 0
|
||||
|
||||
Reference in New Issue
Block a user