mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Further optimize line replacement
This commit is contained in:
@@ -2912,7 +2912,12 @@ class LinesComponent {
|
||||
textNodesByScreenLineId
|
||||
})
|
||||
this.element.insertBefore(newScreenLineComponent.element, oldScreenLineComponent.element)
|
||||
oldScreenLineComponent.destroy()
|
||||
// Instead of calling destroy on the component here we can simply
|
||||
// remove its associated element, thus skipping the
|
||||
// lineNodesByScreenLineId bookkeeping. This is possible because
|
||||
// lineNodesByScreenLineId has already been updated when creating the
|
||||
// new screen line component.
|
||||
oldScreenLineComponent.element.remove()
|
||||
this.lineComponents[lineComponentIndex] = newScreenLineComponent
|
||||
|
||||
oldScreenLineIndex++
|
||||
|
||||
Reference in New Issue
Block a user