From f0591b4afb048fc210f123f370ccc2f5dcbc8f5f Mon Sep 17 00:00:00 2001 From: theprimeagen Date: Thu, 3 Oct 2024 11:17:16 -0600 Subject: [PATCH] fix: scrolling with fraction produces different lines count due to @floor vs @trunc (-1 vs 1) --- src/Surface.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surface.zig b/src/Surface.zig index 3af7b8e9d..3e4501656 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -3745,7 +3745,7 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool .scroll_page_fractional => |fraction| { const rows: f32 = @floatFromInt(self.grid_size.rows); - const delta: isize = @intFromFloat(@floor(fraction * rows)); + const delta: isize = @intFromFloat(@trunc(fraction * rows)); self.io.queueMessage(.{ .scroll_viewport = .{ .delta = delta }, }, .unlocked);