message: be more forgiving with offset that don't have atNodeEnd=true
  if index is not found, it means the last position should be returned
  if there is any.
  We still return -1 for empty documents, as index should always point
  to a valid part if positive.
diff: @@ -388,8 +388,12 @@ export default class EditorModel {
  currentOffset += partLen;
  return false;
  });
  + if (index === -1) {
  + return this.getPositionAtEnd();
  + } else {
  return new DocumentPosition(index, totalOffset - currentOffset);
  }
  + }
  /**
  * Starts a range, which can span across multiple parts, to find and replace text.
  