updateMarkerChanges = (searchMarker, index, len) => {
  for (let i = searchMarker.length - 1; i >= 0; i--) {
    const m = searchMarker[i];

    if (len > 0) {
      /**
       * @type {Item|null}
       */
      let p = m.p;
      p.marker = false; // Ideally we just want to do a simple position comparison, but this will only work if
      // search markers don't point to deleted items for formats.
      // Iterate marker to prev undeleted countable position so we know what to do when updating a position

      while (p && (p.deleted || !p.countable)) {
        p = p.left;

        if (p && !p.deleted && p.countable) {
          // adjust position. the loop should break now
          m.index -= p.length;
        }
      }

      if (p === null || p.marker === true) {
        // remove search marker if updated position is null or if position is already marked
        searchMarker.splice(i, 1);
        continue;
      }

      m.p = p;
      p.marker = true;
    }

    if (index < m.index || len > 0 && index === m.index) {
      // a simple index <= m.index check would actually suffice
      m.index = math.max(index, m.index + len);
    }
  }
}
Update markers when a change happened.

This should be called before doing a deletion!

@param {Array<ArraySearchMarker>} searchMarker
@param {number} index
@param {number} len If insertion, len is positive. If deletion, len is negative.