From 21ff71cc94fb40912466c588256fa7558e6841de Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 11 Jul 2024 17:29:39 -0400 Subject: [PATCH] Fix a cursor position issue when searching forward --- src/common/document.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); }