What
Harden input handling in src/input.sh and src/keymap.sh:
- Generic CSI drain path — when
shellframe_read_key encounters an unrecognized ESC sequence, drain remaining CSI bytes (up to a final byte in @A-Za-z) to prevent buffer leakage corrupting subsequent key reads.
- F1–F12 constants + recognition — add
SHELLFRAME_KEY_F1–SHELLFRAME_KEY_F12 constants and handle them in shellframe_read_key. F1–F4 use SS3 sequences (\x1bOP–\x1bOS); F5–F12 use CSI sequences (\x1b[15~, \x1b[17~–\x1b[21~, \x1b[23~, \x1b[24~).
- Modifier+arrow sequences — recognize
\x1b[1;2A (Shift+Up), \x1b[1;3A (Alt+Up), \x1b[1;5A (Ctrl+Up) and the equivalent Down/Left/Right variants. Add named constants and handle in shellframe_read_key.
Files
src/input.sh — extend shellframe_read_key CSI parsing
src/keymap.sh — add new key constants; extend shellframe_keyname
Done criteria
IO/timing note (CLAUDE.md §5)
The CSI drain path involves real terminal read timing. Do not rely on theoretical reasoning about when bytes arrive — write a test that injects a synthetic unrecognized sequence into a real bash process and confirms drain works correctly.
Effort
S (1–2h)
Deps
What
Harden input handling in
src/input.shandsrc/keymap.sh:shellframe_read_keyencounters an unrecognized ESC sequence, drain remaining CSI bytes (up to a final byte in@A-Za-z) to prevent buffer leakage corrupting subsequent key reads.SHELLFRAME_KEY_F1–SHELLFRAME_KEY_F12constants and handle them inshellframe_read_key. F1–F4 use SS3 sequences (\x1bOP–\x1bOS); F5–F12 use CSI sequences (\x1b[15~,\x1b[17~–\x1b[21~,\x1b[23~,\x1b[24~).\x1b[1;2A(Shift+Up),\x1b[1;3A(Alt+Up),\x1b[1;5A(Ctrl+Up) and the equivalent Down/Left/Right variants. Add named constants and handle inshellframe_read_key.Files
src/input.sh— extendshellframe_read_keyCSI parsingsrc/keymap.sh— add new key constants; extendshellframe_keynameDone criteria
shellframe_keynametests/unit/test-input.sh+tests/unit/test-keymap.shcovering all new constants and drain behaviorIO/timing note (CLAUDE.md §5)
The CSI drain path involves real terminal read timing. Do not rely on theoretical reasoning about when bytes arrive — write a test that injects a synthetic unrecognized sequence into a real bash process and confirms drain works correctly.
Effort
S (1–2h)
Deps