mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Update the vertical scroll bar when scrollTop changes in the model
This commit is contained in:
parent
e472d7b038
commit
ab02d5f25f
@ -82,6 +82,16 @@ describe "EditorComponent", ->
|
||||
expect(cursorNodes[0].offsetTop).toBe 6 * lineHeightInPixels
|
||||
expect(cursorNodes[0].offsetLeft).toBe 11 * charWidth
|
||||
|
||||
it "updates the scroll bar when the scrollTop is changed in the model", ->
|
||||
node.style.height = 4.5 * lineHeightInPixels + 'px'
|
||||
component.updateAllDimensions()
|
||||
|
||||
scrollbarNode = node.querySelector('.vertical-scrollbar')
|
||||
expect(scrollbarNode.scrollTop).toBe 0
|
||||
|
||||
editor.setScrollTop(10)
|
||||
expect(scrollbarNode.scrollTop).toBe 10
|
||||
|
||||
it "accounts for character widths when positioning cursors", ->
|
||||
atom.config.set('editor.fontFamily', 'sans-serif')
|
||||
editor.setCursorScreenPosition([0, 16])
|
||||
|
@ -78,6 +78,10 @@ EditorCompont = React.createClass
|
||||
@getDOMNode().removeEventListener 'mousewheel', @onMousewheel
|
||||
|
||||
componentDidUpdate: ->
|
||||
# React offers a scrollTop property on element descriptors but it doesn't
|
||||
# seem to work when reloading the editor while already scrolled down.
|
||||
# Perhaps it's trying to assign it before the element inside is tall enough?
|
||||
@refs.verticalScrollbar.getDOMNode().scrollTop = @props.editor.getScrollTop()
|
||||
@measureNewLines()
|
||||
|
||||
observeEditor: ->
|
||||
|
Loading…
Reference in New Issue
Block a user