Limit line decoration update to visible row range

Previously, if we had selections exceeding the visible range we would do
a bunch of unnecessary work and rendering would become very slow.
This commit is contained in:
Nathan Sobo
2016-12-21 17:54:55 -07:00
parent afba1560f5
commit 8fbf42dfd5

View File

@@ -1141,7 +1141,9 @@ class TextEditorPresenter
@lineNumberDecorationsByScreenRow[screenRow] ?= {}
@lineNumberDecorationsByScreenRow[screenRow][decorationId] = properties
else
for row in [screenRange.start.row..screenRange.end.row] by 1
startRow = Math.max(screenRange.start.row, @getStartTileRow())
endRow = Math.min(screenRange.end.row, @getEndTileRow() + @tileSize)
for row in [startRow..endRow] by 1
continue if properties.onlyHead and row isnt headScreenPosition.row
continue if omitLastRow and row is screenRange.end.row