Guard gitFirst/LastVisibleScreenRow

These methods are sometimes called by the model before the editor has
been attached to the DOM.
This commit is contained in:
Nathan Sobo
2017-04-18 17:42:43 -06:00
committed by Antonio Scandurra
parent eb7cdf2a34
commit 5ea4096464

View File

@@ -2315,14 +2315,18 @@ class TextEditorComponent {
}
getFirstVisibleRow () {
return this.rowForPixelPosition(this.getScrollTop())
if (this.measurements) {
return this.rowForPixelPosition(this.getScrollTop())
}
}
getLastVisibleRow () {
return Math.min(
this.props.model.getApproximateScreenLineCount() - 1,
this.rowForPixelPosition(this.getScrollBottom())
)
if (this.measurements) {
return Math.min(
this.props.model.getApproximateScreenLineCount() - 1,
this.rowForPixelPosition(this.getScrollBottom())
)
}
}
getFirstVisibleColumn () {