fix ListIterator backwards iteration within moved ranges

This commit is contained in:
Kevin Jahns
2022-03-29 16:55:22 +02:00
parent c4b28aceec
commit f65d1b8475
3 changed files with 36 additions and 23 deletions

View File

@@ -185,7 +185,7 @@ export class ContentMove {
if (!start.deleted) {
const currMoved = start.moved
const nextPrio = currMoved ? /** @type {ContentMove} */ (currMoved.content).priority : -1
if (currMoved === null || adaptPriority || nextPrio < this.priority || currMoved.id.client < item.id.client || (currMoved.id.client === item.id.client && currMoved.id.clock < item.id.clock)) {
if (adaptPriority || nextPrio < this.priority || (currMoved != null && nextPrio === this.priority && (currMoved.id.client < item.id.client || (currMoved.id.client === item.id.client && currMoved.id.clock < item.id.clock)))) {
if (currMoved !== null) {
this.overrides.add(currMoved)
}
@@ -198,7 +198,7 @@ export class ContentMove {
transaction.prevMoved.set(start, prevMove)
}
start.moved = item
} else {
} else if (currMoved != null) {
/** @type {ContentMove} */ (currMoved.content).overrides.add(item)
}
}