mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
Insert "position: after" decorations in increasing order
This commit is contained in:
@@ -3866,15 +3866,24 @@ class LinesTileComponent {
|
||||
|
||||
if (blockDecorations) {
|
||||
blockDecorations.forEach((newDecorations, screenLineId) => {
|
||||
var oldDecorations = oldProps.blockDecorations ? oldProps.blockDecorations.get(screenLineId) : null
|
||||
for (var i = 0; i < newDecorations.length; i++) {
|
||||
var newDecoration = newDecorations[i]
|
||||
if (oldDecorations && oldDecorations.includes(newDecoration)) continue
|
||||
const oldDecorations = oldProps.blockDecorations ? oldProps.blockDecorations.get(screenLineId) : null
|
||||
const lineNode = lineComponentsByScreenLineId.get(screenLineId).element
|
||||
let lastAfter = lineNode
|
||||
|
||||
for (let i = 0; i < newDecorations.length; i++) {
|
||||
const newDecoration = newDecorations[i]
|
||||
const element = TextEditor.viewForItem(newDecoration.item)
|
||||
|
||||
if (oldDecorations && oldDecorations.includes(newDecoration)) {
|
||||
if (newDecoration.position === 'after') {
|
||||
lastAfter = element
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
var element = TextEditor.viewForItem(newDecoration.item)
|
||||
var lineNode = lineComponentsByScreenLineId.get(screenLineId).element
|
||||
if (newDecoration.position === 'after') {
|
||||
this.element.insertBefore(element, lineNode.nextSibling)
|
||||
this.element.insertBefore(element, lastAfter.nextSibling)
|
||||
lastAfter = element
|
||||
} else {
|
||||
this.element.insertBefore(element, lineNode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user