fix a bunch of issues with range-move approach

This commit is contained in:
Kevin Jahns
2022-05-07 16:14:18 +02:00
parent 69b7f4bfb9
commit 1f99e8203a
3 changed files with 36 additions and 23 deletions

View File

@@ -569,7 +569,6 @@ const arrayTransactions = [
const newPos = _newPosAdj + (_newPosAdj > yarray.length - len ? len : 0)
const oldContent = yarray.toArray()
yarray.moveRange(pos, pos + len - 1, newPos)
console.log(`moving range ${pos}-${pos + len - 1} to ${newPos}`)
const movedValues = oldContent.splice(pos, len)
oldContent.splice(pos < newPos ? newPos - len : newPos, 0, ...movedValues)
t.compareArrays(yarray.toArray(), oldContent) // we want to make sure that fastSearch markers insert at the correct position