diff --git a/src/common/document.ts b/src/common/document.ts index 90560bd..6127b00 100644 --- a/src/common/document.ts +++ b/src/common/document.ts @@ -82,12 +82,17 @@ export class Document { for (let y = start; y < end; y++) { if (this.row(position.y).isNone()) { + logWarning('Invalid Search location', { + position, + document: this, + }); + return None; } const maybeMatch = this.#rows[y].find(q, position.x, direction); if (maybeMatch.isSome()) { - position.x = maybeMatch.unwrap(); + position.x = this.#rows[y].rxToCx(maybeMatch.unwrap()); return Some(position); }