From 3a0392c282605b60bd2ce133e2ad394a7819a1dc Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 13 Jun 2024 14:52:52 +0200 Subject: [PATCH] tty(windows): fix mouse wheel direction calculation --- src/windows/Tty.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/windows/Tty.zig b/src/windows/Tty.zig index 8b47384..9fffab7 100644 --- a/src/windows/Tty.zig +++ b/src/windows/Tty.zig @@ -291,10 +291,10 @@ pub fn nextEvent(self: *Tty) !Event { // High word of dwButtonState represents mouse wheel. Positive is wheel_up, negative // is wheel_down // Low word represents button state - const mouse_wheel_direction: i32 = blk: { - const wheelu64: u64 = event.dwButtonState >> 16; - const wheelu32: u32 = @truncate(wheelu64); - break :blk @bitCast(wheelu32); + const mouse_wheel_direction: i16 = blk: { + const wheelu32: u32 = event.dwButtonState >> 16; + const wheelu16: u16 = @truncate(wheelu32); + break :blk @bitCast(wheelu16); }; const buttons: u16 = @truncate(event.dwButtonState);