mirror of
https://github.com/atom/atom.git
synced 2026-02-18 02:21:43 -05:00
Don't try to measure lines that don't exist
By the time that the animation frame is delivered, the requested autoscroll position could not exist anymore. This could cause the editor component to measure a non-existent line and, as a result, throw an exception. With this commit we will always ignore measurements for screen lines that do not exist.
This commit is contained in:
@@ -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