this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

parser: fix query responses for kitty kbd, decrpm

+10 -3
+10 -3
src/Parser.zig
··· 290 290 inline fn parseCsi(input: []const u8, text_buf: []u8) Result { 291 291 // We start iterating at index 2 to get past te '[' 292 292 const sequence = for (input[2..], 2..) |b, i| { 293 + if (i == 2 and b == '?') continue; 293 294 switch (b) { 294 295 0x40...0xFF => break input[0 .. i + 1], 295 296 else => continue, 296 297 } 297 298 } else return .{ .event = null, .n = 0 }; 299 + std.log.err("{s}\r\n", .{sequence[1..]}); 298 300 299 301 const null_event: Result = .{ .event = null, .n = sequence.len }; 300 302 ··· 431 433 // Not all fields will be present. Only unicode-key-code is 432 434 // mandatory 433 435 436 + if (sequence.len > 2 and sequence[2] == '?') return .{ 437 + .event = .cap_kitty_keyboard, 438 + .n = sequence.len, 439 + }; 440 + 434 441 var key: Key = .{ 435 442 .codepoint = undefined, 436 443 }; ··· 487 494 return .{ .event = event, .n = sequence.len }; 488 495 }, 489 496 'y' => { 490 - // DECRPM (CSI Ps ; Pm y) 497 + // DECRPM (CSI ? Ps ; Pm $ y) 491 498 const delim_idx = std.mem.indexOfScalarPos(u8, input, 2, ';') orelse return null_event; 492 - const ps = std.fmt.parseUnsigned(u16, input[2..delim_idx], 10) catch return null_event; 493 - const pm = std.fmt.parseUnsigned(u8, input[delim_idx + 1 .. sequence.len - 1], 10) catch return null_event; 499 + const ps = std.fmt.parseUnsigned(u16, input[3..delim_idx], 10) catch return null_event; 500 + const pm = std.fmt.parseUnsigned(u8, input[delim_idx + 1 .. sequence.len - 2], 10) catch return null_event; 494 501 switch (ps) { 495 502 // Mouse Pixel reporting 496 503 1016 => switch (pm) {