mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Merge pull request #14734 from atom/as-ns-clip-autoscroll
Don't try to measure lines that don't exist
This commit is contained in:
@@ -961,6 +961,14 @@ describe('TextEditorComponent', () => {
|
||||
expect(component.getScrollLeft()).toBe(component.getScrollWidth() - component.getScrollContainerClientWidth())
|
||||
})
|
||||
|
||||
it('does not try to measure lines that do not exist when the animation frame is delivered', async () => {
|
||||
const {component, editor} = buildComponent({autoHeight: false, height: 30, rowsPerTile: 2})
|
||||
editor.scrollToBufferPosition([11, 5])
|
||||
editor.getBuffer().deleteRows(11, 12)
|
||||
await component.getNextUpdatePromise()
|
||||
expect(component.getScrollBottom()).toBe((10 + 1) * component.measurements.lineHeight)
|
||||
})
|
||||
|
||||
it('accounts for the presence of horizontal scrollbars that appear during the same frame as the autoscroll', async () => {
|
||||
const {component, element, editor} = buildComponent({autoHeight: false})
|
||||
const {scrollContainer} = component.refs
|
||||
|
||||
@@ -332,7 +332,7 @@ class TextEditorComponent {
|
||||
this.derivedDimensionsCache = {}
|
||||
this.updateModelSoftWrapColumn()
|
||||
if (this.pendingAutoscroll) {
|
||||
const {screenRange, options} = this.pendingAutoscroll
|
||||
let {screenRange, options} = this.pendingAutoscroll
|
||||
this.autoscrollVertically(screenRange, options)
|
||||
this.requestHorizontalMeasurement(screenRange.start.row, screenRange.start.column)
|
||||
this.requestHorizontalMeasurement(screenRange.end.row, screenRange.end.column)
|
||||
@@ -2097,7 +2097,12 @@ class TextEditorComponent {
|
||||
if (column === 0) return
|
||||
|
||||
if (row < this.getRenderedStartRow() || row >= this.getRenderedEndRow()) {
|
||||
this.requestExtraLineToMeasure(row, this.props.model.screenLineForScreenRow(row))
|
||||
const screenLine = this.props.model.screenLineForScreenRow(row)
|
||||
if (screenLine) {
|
||||
this.requestExtraLineToMeasure(row, screenLine)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let columns = this.horizontalPositionsToMeasure.get(row)
|
||||
|
||||
Reference in New Issue
Block a user