szn

Bug 79 — Modified function key parsing broken — ~ CSI sequences with modifiers dropped

79. Modified function key parsing broken — ~ CSI sequences with modifiers dropped

File: src/key.zig:96–101 Severity: HIGH Status: ✅ FIXED — split num_str on ; to extract key number before modifier parameter. Unit test added.

'~' => {
    const tilde = std.mem.lastIndexOfScalar(u8, seq, '~') orelse return error.InvalidCsi;
    const num_str = seq[0..tilde];  // "11;5" for Ctrl+F1 = \e[11;5~
    const num = std.fmt.parseInt(u8, num_str, 10) catch return error.InvalidCsi;

For \e[11;5~ (Ctrl+F1), seq is 11;5~, num_str is 11;5. parseInt(u8, "11;5", 10) fails — the modifier parameter and semicolon are included. All Ctrl/Alt/Shift modified function keys and special keys (Home, End, Insert, Delete, PgUp, PgDn, F1-F12) are silently dropped.