summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 01:30:17 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit3f017863e08208119859f9362a5c633ac39d4316 (patch)
tree9d5d0520fc5047d5157384244d289b8a68125082 /src
parentd76c4f260efaca12cb2e7093e5305cfd972564dc (diff)
downloadpardes-3f017863e08208119859f9362a5c633ac39d4316.tar.gz
pardes-3f017863e08208119859f9362a5c633ac39d4316.zip
The look walk goes on from a restored dot both ways
After a Restore the dot came back on the match it was on, but N stayed on that match instead of wrapping to the last as it does live: the walk remembers the spot it landed on (look_at), and a restored pane has none, so it stood at the cursor, the selection's end, and found the match it was in. A one-row selection now counts as where the walk stands, from its start and past it either way, as a landed spot does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/look.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/look.zig b/src/look.zig
index 17746cd1..542b1b63 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -748,6 +748,12 @@ fn lookEdge(delta: i32) LookFrom {
fn lookStand(pane: *Pane) LookFrom {
if (pane.look_at) |s| if (s.row == pane.body.cur_row and s.col0 == pane.body.cur_col)
return .{ .row = s.row, .col = s.col0, .strict = true };
+ // A selection on one row (a Restore brings the dot back as one, with no
+ // walk remembered) is where the walk stands: from its start, past it
+ // either way, as from a spot the walk landed on.
+ const v = pane.body.vsel;
+ if (v.active and v.explicit and v.row == pane.body.cur_row and v.col != pane.body.cur_col)
+ return .{ .row = v.row, .col = @min(v.col, pane.body.cur_col), .strict = true };
return .{ .row = pane.body.cur_row, .col = pane.body.cur_col };
}