mirror of
https://github.com/atom/atom.git
synced 2026-01-30 01:08:31 -05:00
Prevent updates for off-screen line decoration markers on change
When there were lots of off-screen markers, we were performing lots of redundant updates when off-screen markers changed. Now we only perform updates if they intersect the visible row range. @maxbrunsfeld this should improve the situation for folding/unfolding when there are lots of others folds. Let me know.
This commit is contained in:
@@ -563,12 +563,27 @@ class TextEditorPresenter
|
||||
|
||||
decorationMarkerDidChange: (decoration, change) ->
|
||||
if decoration.isType('line') or decoration.isType('line-number')
|
||||
@removeFromLineDecorationCaches(decoration, new Range(change.oldTailScreenPosition, change.oldHeadScreenPosition))
|
||||
@addToLineDecorationCaches(decoration, new Range(change.newTailScreenPosition, change.newHeadScreenPosition))
|
||||
@updateLinesState() if decoration.isType('line')
|
||||
@updateLineNumbersState() if decoration.isType('line-number')
|
||||
intersectsVisibleRowRange = false
|
||||
startRow = @computeStartRow()
|
||||
endRow = @computeEndRow()
|
||||
oldRange = new Range(change.oldTailScreenPosition, change.oldHeadScreenPosition)
|
||||
newRange = new Range(change.newTailScreenPosition, change.newHeadScreenPosition)
|
||||
|
||||
if oldRange.intersectsRowRange(startRow, endRow - 1)
|
||||
@removeFromLineDecorationCaches(decoration, oldRange)
|
||||
intersectsVisibleRowRange = true
|
||||
|
||||
if newRange.intersectsRowRange(startRow, endRow - 1)
|
||||
@addToLineDecorationCaches(decoration, newRange)
|
||||
intersectsVisibleRowRange = true
|
||||
|
||||
if intersectsVisibleRowRange
|
||||
@updateLinesState() if decoration.isType('line')
|
||||
@updateLineNumbersState() if decoration.isType('line-number')
|
||||
|
||||
if decoration.isType('highlight')
|
||||
@updateHighlightState(decoration)
|
||||
|
||||
if decoration.isType('overlay')
|
||||
@updateOverlaysState()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user