szn

Bug 430 — kitty ‘u’ keyboard protocol returns .char, never matches .special/.arrow/.function bindings

430. kitty ‘u’ keyboard protocol returns .char, never matches .special/.arrow/.function bindings

Severity: MEDIUM-HIGH Status: Fixed

Under the kitty keyboard protocol, CSI code;mods u emits a codepoint for every key — including special keys (Tab = 0x09, Enter = 0x0D, Escape = 0x1B, Backspace = 0x08). parseCsi returns these as .char:

// src/key.zig:143-176
'u' => {
    const codepoint = std.fmt.parseInt(u32, codepoint_str, 10) catch return error.InvalidCsi;
    // ...
    return Key{ .char = .{ .code = @intCast(codepoint), .mod = k_mod } };
},

But keysEqual (in key_binding.zig) requires the active tags to match:

if (std.meta.activeTag(a) != std.meta.activeTag(b)) return false;

So a binding recorded as .special{ .key = .tab } can never equal a .char{ .code = 9 } key, even though they are the same physical key.

Problem & Impact

Proposed Fix

After parsing the codepoint in the u branch, normalize well-known codepoints to their Key variant before returning: