diff options
Diffstat (limited to 'gui/src/Navigation.zig')
| -rw-r--r-- | gui/src/Navigation.zig | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gui/src/Navigation.zig b/gui/src/Navigation.zig index f9ae34a..7edd4d9 100644 --- a/gui/src/Navigation.zig +++ b/gui/src/Navigation.zig @@ -1,7 +1,7 @@ //! Bounded per-pane jump history. Scrolling changes the current location, not the target. const std = @import("std"); const Navigation = @This(); -pub const Location = struct { address: u64 = 0, row: f32 = 0, follow: bool = true }; +pub const Location = struct { address: u64 = 0, row: f64 = 0, follow: bool = true, manual: bool = false }; place: Location = .{}, history: [32]Location = @splat(.{}), len: u8 = 0, @@ -45,7 +45,7 @@ test "pane jumps retain scroll and discard the abandoned forward branch" { n.place.row = 3; n.visit(0x2000); n.back(); - try std.testing.expectEqual(@as(f32, 3), n.place.row); + try std.testing.expectEqual(@as(f64, 3), n.place.row); n.visit(0x3000); n.forward(); try std.testing.expectEqual(@as(u64, 0x3000), n.place.address); @@ -54,3 +54,13 @@ test "pane jumps retain scroll and discard the abandoned forward branch" { for (0..40) |_| n.back(); try std.testing.expectEqual(@as(u64, 0x4008), n.place.address); } + +test "large mapping row history keeps individual words reachable" { + var n: Navigation = .{}; + n.visit(0x100000000); + n.place.row = 268435455; + n.place.row -= 1; + n.visit(0x200000000); + n.back(); + try std.testing.expectEqual(@as(f64, 268435454), n.place.row); +} |
