szn

Bug 351 — Modified tilde keys silently dropped by client-side pre-parse

351. \x1b[3;5~ (Ctrl+Delete) lost before parseCsi can decode it

File: src/tty/tty_key.zig:203-211 Severity: HIGH Status: ✅ FIXED

Fix (applied)

src/tty/tty_key.zig dispatchCsi now special-cases only plain-number tilde sequences (bracketed paste 200/201); anything else — including 3;5~, 2;2~, 11;2~ — falls through to key.parseCsi, which already splits the key number from the modifier parameter.

Tests: modified tilde key ctrl delete — bug #351, modified tilde key shift insert — bug #351 (full-sequence decoder tests).

Problem

Every xterm modified tilde key — Ctrl+Delete (ESC[3;5~), Shift+Insert (ESC[2;2~), Ctrl+PageUp (ESC[5;5~), Shift+F1..F12 (ESC[11;2~) etc. — produces no key event at all.

Root Cause

dispatchCsi intercepts ~ finals and attempts a plain integer parse of the full parameter string:

const num = std.fmt.parseInt(u16, tilde_params, 10) catch {
    std.log.debug("input: invalid tilde params '{s}'", .{tilde_params});
    return null;                       // ← swallows "3;5"
};
if (num == 200) return Event{ .paste_start = {} };
if (num == 201) return Event{ .paste_end = {} };

\x1b[3;5~ yields params 3;5 → parse fails → early return null. Control never reaches key.parseCsi(seq), whose '~' branch (key.zig:115-141) splits the key number from the modifier parameter correctly (see its passing tests parse modified function keys via tilde CSI).

Fix (proposed)

Only special-case bracketed paste for exactly 200/201 with no modifier suffix; otherwise fall through to parseCsi. Add regression tests feeding \x1b[3;5~ expecting special.delete_ + ctrl mod, and \x1b[11;2~ expecting f1 + shift.