fix backwards edge case

This commit is contained in:
Kevin Jahns
2021-11-21 14:00:02 +01:00
parent 4a8ebc31f7
commit 40c3be1732
2 changed files with 31 additions and 13 deletions

View File

@@ -202,7 +202,7 @@ export class ListIterator {
item = item.left
}
this.index -= len
this.nextItem = item
this.nextItem = item && item.right
return this
}
@@ -278,11 +278,12 @@ export class ListIterator {
if (item && !this.reachedEnd && len > 0) {
this.nextItem = item
this.forward(tr, 0)
item = this.nextItem
}
}
this.nextItem = item
if (sm) {
updateMarkerChanges(tr, sm, this.index, -startLength + len)
updateMarkerChanges(sm, this.index, -startLength + len, this)
}
}
@@ -369,7 +370,7 @@ export class ListIterator {
this.nextItem = right
}
if (sm) {
updateMarkerChanges(tr, sm, this.index, content.length)
updateMarkerChanges(sm, this.index, content.length, this)
}
this.index += content.length
}