diff options
| -rw-r--r-- | src/look.zig | 6 | ||||
| -rw-r--r-- | test/output.zig | 7 |
2 files changed, 11 insertions, 2 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 }; } diff --git a/test/output.zig b/test/output.zig index 95cdbfb7..419bcca2 100644 --- a/test/output.zig +++ b/test/output.zig @@ -1590,10 +1590,13 @@ test "stacked search and LSP results retain source tint navigation and dump owne } restored.active = id; pardes.look.armLookWalk(restored, id); - // The dot came back on the match it was on; the walk goes on. + // The dot came back on the match it was on; the walk goes on + // from it both ways, N wrapping to the last as it does live. try std.testing.expectEqual(@as(i32, @intCast(matches[0])), restored.panes[id].?.body.cur_row); - restored.update(.{ .key = .{ .cp = 'n' } }); + restored.update(.{ .key = .{ .cp = 'N' } }); try std.testing.expectEqual(@as(i32, @intCast(matches[1])), restored.panes[id].?.body.cur_row); + restored.update(.{ .key = .{ .cp = 'n' } }); + try std.testing.expectEqual(@as(i32, @intCast(matches[0])), restored.panes[id].?.body.cur_row); try std.testing.expectEqualStrings(source_text, source.file.?.content); } } |
