Fix a cursor position issue when searching forward
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2024-07-11 17:29:39 -04:00
parent 2c21bf0c9b
commit 21ff71cc94

View File

@ -82,12 +82,17 @@ export class Document {
for (let y = start; y < end; y++) { for (let y = start; y < end; y++) {
if (this.row(position.y).isNone()) { if (this.row(position.y).isNone()) {
logWarning('Invalid Search location', {
position,
document: this,
});
return None; return None;
} }
const maybeMatch = this.#rows[y].find(q, position.x, direction); const maybeMatch = this.#rows[y].find(q, position.x, direction);
if (maybeMatch.isSome()) { if (maybeMatch.isSome()) {
position.x = maybeMatch.unwrap(); position.x = this.#rows[y].rxToCx(maybeMatch.unwrap());
return Some(position); return Some(position);
} }