diff --git a/src/types/YText.js b/src/types/YText.js index 46beac05..76b66de6 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -127,8 +127,9 @@ const findPosition = (transaction, parent, index) => { const currentAttributes = new Map() if (parent._searchMarker) { return useSearchMarker(transaction, parent, index, listIter => { + // @todo this should simply split if .rel > 0 const pos = new ItemTextListPosition(listIter.left, listIter.right, listIter.index, currentAttributes) - return findNextPosition(transaction, pos, index - listIter.index) + return findNextPosition(transaction, pos, index - listIter.index + listIter.rel) }) } else { const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes) diff --git a/src/utils/ListIterator.js b/src/utils/ListIterator.js index cfa03692..7e3463a5 100644 --- a/src/utils/ListIterator.js +++ b/src/utils/ListIterator.js @@ -126,6 +126,7 @@ export class ListIterator { len -= item.length if (len < 0) { this.rel = item.length + len + len = 0 break } } else if (item.content.constructor === ContentMove && item.moved === this.currMove) { @@ -176,6 +177,7 @@ export class ListIterator { len -= item.length if (len < 0) { this.rel = item.length + len + len = 0 break } } else if (item.content.constructor === ContentMove && item.moved === this.currMove) {