From a75cce6e78f827fb8a7be536c6ee3c994c1d8814 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 22 May 2024 17:54:38 +0200 Subject: [PATCH] parser: fix panic on zero mouse coordinate reports --- src/Parser.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Parser.zig b/src/Parser.zig index d18adb8..885d6bd 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -260,8 +260,8 @@ pub fn parse(self: *Parser, input: []const u8, paste_allocator: ?std.mem.Allocat const shift = seq.params[0] & mouse_bits.shift > 0; const alt = seq.params[0] & mouse_bits.alt > 0; const ctrl = seq.params[0] & mouse_bits.ctrl > 0; - const col: usize = seq.params[1] - 1; - const row: usize = seq.params[2] - 1; + const col: usize = if(seq.params[1] > 0) seq.params[1] - 1 else 0; + const row: usize = if(seq.params[2] > 0) seq.params[2] - 1 else 0; const mouse = Mouse{ .button = button,