fix various tests

This commit is contained in:
Kevin Jahns
2021-12-08 16:10:49 +01:00
parent 6fc4fbd466
commit d3dcd24ef4
4 changed files with 63 additions and 8 deletions

View File

@@ -286,8 +286,8 @@ export class ListIterator {
const startLength = len
const sm = this.type._searchMarker
let item = this.nextItem
while (len > 0 && !this.reachedEnd) {
while (item && !item.deleted && item.countable && !this.reachedEnd && len > 0) {
while (len > 0) {
while (item && !item.deleted && item.countable && !this.reachedEnd && len > 0 && item.moved === this.currMove && item !== this.currMoveEnd) {
if (this.rel > 0) {
item = getItemCleanStart(tr, createID(item.id.client, item.id.clock + this.rel))
this.rel = 0
@@ -303,7 +303,7 @@ export class ListIterator {
this.reachedEnd = true
}
}
if (item && !this.reachedEnd && len > 0) {
if (len > 0) {
this.nextItem = item
this.forward(tr, 0)
item = this.nextItem

View File

@@ -195,13 +195,15 @@ export class YEvent {
delta.push(lastOp)
}
}
for (let item = target._start; item !== null;) {
if (item === currMoveEnd) {
for (let item = target._start; ;) {
if (item === currMoveEnd && currMove) {
item = currMove
const { end, move, isNew } = movedStack.pop() || { end: null, move: null, isNew: false }
currMoveIsNew = isNew
currMoveEnd = end
currMove = move
} else if (item === null) {
break
} else if (item.content.constructor === ContentMove) {
if (item.moved === currMove) {
movedStack.push({ end: currMoveEnd, move: currMove, isNew: currMoveIsNew })
@@ -213,7 +215,7 @@ export class YEvent {
continue // do not move to item.right
}
} else if (item.moved !== currMove) {
if (!currMoveIsNew && item.countable && item.moved && !this.adds(item) && !this.adds(item.moved) && (this.transaction.prevMoved.get(item) || null) === currMove) {
if (!currMoveIsNew && item.countable && item.moved && !this.adds(item) && this.adds(item.moved) && (this.transaction.prevMoved.get(item) || null) === currMove) {
if (lastOp === null || lastOp.delete === undefined) {
packOp()
lastOp = { delete: 0 }