From ab20fc3b19deeedfb47fb15f36bbe1d687df889b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 10 May 2017 10:48:16 +0200 Subject: [PATCH] Don't populate more screen rows than necessary See 4eecf8d1a683e6b4e4c3b16a08907b1bfd7f0af7. --- src/text-editor-component.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index ea28c0f3c..7002a746f 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -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 () {