Don't populate more screen rows than necessary

See 4eecf8d1a6.
This commit is contained in:
Antonio Scandurra
2017-05-10 10:48:16 +02:00
parent ebf2aaa688
commit ab20fc3b19

View File

@@ -2673,11 +2673,10 @@ class TextEditorComponent {
// Ensure the spatial index is populated with rows that are currently
// visible so we *at least* get the longest row in the visible range.
populateVisibleRowRange () {
const lastPossibleVisibleRow = this.rowForPixelPosition(this.getScrollBottom())
const maxPossibleVisibleRows = lastPossibleVisibleRow - this.getFirstVisibleRow()
const maxPossibleVisibleTileCount = Math.ceil(maxPossibleVisibleRows / this.getRowsPerTile()) + 1
const lastPossibleRenderedRow = this.getRenderedStartRow() + maxPossibleVisibleTileCount * this.getRowsPerTile()
this.props.model.displayLayer.populateSpatialIndexIfNeeded(Infinity, lastPossibleRenderedRow)
const editorHeightInTiles = this.getScrollContainerHeight() / this.getLineHeight()
const visibleTileCount = Math.ceil(editorHeightInTiles) + 1
const lastRenderedRow = this.getRenderedStartRow() + (visibleTileCount * this.getRowsPerTile())
this.props.model.displayLayer.populateSpatialIndexIfNeeded(Infinity, lastRenderedRow)
}
populateVisibleTiles () {