mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Update lines for line insertions/removals preceding rendered row range
This commit is contained in:
@@ -111,6 +111,22 @@ describe "EditorComponent", ->
|
||||
expect(component.lineNodeForScreenRow(3).offsetTop).toBe 3 * lineHeightInPixels
|
||||
expect(component.lineNodeForScreenRow(4).offsetTop).toBe 4 * lineHeightInPixels
|
||||
|
||||
it "updates the lines when lines are inserted or removed above the rendered row range", ->
|
||||
node.style.height = 4.5 * lineHeightInPixels + 'px'
|
||||
component.measureScrollView()
|
||||
runSetImmediateCallbacks()
|
||||
verticalScrollbarNode.scrollTop = 5 * lineHeightInPixels
|
||||
verticalScrollbarNode.dispatchEvent(new UIEvent('scroll'))
|
||||
buffer = editor.getBuffer()
|
||||
|
||||
buffer.insert([0, 0], '\n\n')
|
||||
runSetImmediateCallbacks()
|
||||
expect(component.lineNodeForScreenRow(3).textContent).toBe editor.lineForScreenRow(3).text
|
||||
|
||||
buffer.delete([[0, 0], [3, 0]])
|
||||
runSetImmediateCallbacks()
|
||||
expect(component.lineNodeForScreenRow(3).textContent).toBe editor.lineForScreenRow(3).text
|
||||
|
||||
it "updates the top position of lines when the line height changes", ->
|
||||
initialLineHeightInPixels = editor.getLineHeightInPixels()
|
||||
component.setLineHeight(2)
|
||||
|
||||
@@ -53,7 +53,10 @@ LinesComponent = React.createClass
|
||||
{renderedRowRange, pendingChanges} = newProps
|
||||
[renderedStartRow, renderedEndRow] = renderedRowRange
|
||||
for change in pendingChanges
|
||||
return true unless change.end < renderedStartRow or renderedEndRow <= change.start
|
||||
if change.screenDelta is 0
|
||||
return true unless change.end < renderedStartRow or renderedEndRow <= change.start
|
||||
else
|
||||
return true unless renderedEndRow <= change.start
|
||||
|
||||
false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user