docs: final spec fixes from Codex round 7

- Note uppercase test uses Ink's codepoint-65 form (terminal variant)
- Specify ignore?: boolean on Keypress type
- Update late-response description to use ignore flag path

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-27 12:48:24 +08:00
parent 7fb1a9fee5
commit 31e3d0b333
@@ -109,7 +109,7 @@ export function parseKeypress(s: string): Keypress {
}
```
The `ignore: true` flag tells useInput to skip this keypress entirely — the user handler is NOT called. This handles both scenarios: (1) late responses after detection timeout, (2) responses during the dual-listener race window.
The `ignore: true` flag tells useInput to skip this keypress entirely — the user handler is NOT called. The `Keypress` type must be extended with `ignore?: boolean`. This handles both scenarios: (1) late responses after detection timeout, (2) responses during the dual-listener race window.
**useInput** must check for `ignore` before calling the handler:
@@ -225,7 +225,7 @@ Helper function `kittyKey(codepoint, modifiers?, eventType?, textCodepoints?)` c
**Basic character + modifier parsing (11 tests):**
- Simple character 'a' (`\x1b[97u`)
- Uppercase with shift (`\x1b[65;2u`)
- Uppercase with shift (`\x1b[65;2u`) — note: strict kitty spec says lowercase codepoint (97), but some terminals send uppercase (65). Matches Ink's test.
- Ctrl modifier (`\x1b[97;5u`)
- Alt/option modifier (`\x1b[97;3u`)
- Super modifier (`\x1b[97;9u`)
@@ -360,7 +360,7 @@ Tests the protocol enable/disable/auto-detect flow. Uses fake stdin/stdout strea
- Query response split across two stdin data chunks — bytes reassembled correctly
**Late response after timeout (1 test):**
- Terminal responds after 200ms timeout — protocol not enabled (late response bytes flow to normal input pipeline as an unknown escape sequence, which is harmless since `\x1b[?1u` does not match the kitty CSI u parser regex)
- Terminal responds after 200ms timeout — protocol not enabled (late response bytes flow to normal input pipeline where parseKeypress marks them with `ignore: true`, producing zero useInput handler calls)
**Query response suppression in useInput (1 test):**
- `\x1b[?1u` arriving at useInput (late response or race) produces zero handler calls (ignore flag)