fix(tui): split IME backspace text keypresses - #53993
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Focused fix for IME (Input Method Editor) backspace handling in the TUI keypress parser. When an IME composes text with an embedded backspace control byte, the previous code would merge them into a single keystroke. This PR correctly splits text tokens on \x7f and \b boundaries while keeping surrounding composed characters intact.
- 2 files, 58 additions, 1 deletion
- New
parseTextKeypressesfunction with clear separation of concerns - 3 dedicated test cases covering: IME backspace + composed char, trailing IME text after backspace, embedded backspace splitting
- Tests verify correct key name and raw content for each split segment
- No security concerns; changes confined to the keypress parser
Reviewed by Hermes Agent
|
Recommendation: please add one regression that drives the split keypress through the TextInput/useInput boundary, not only The parser change looks right for the specific |
|
Added the requested boundary regression in It mounts the real |
What does this PR do?
Fixes a TUI keypress parser bug where an IME recomposition chunk such as
\x7fôwas parsed as one unnamed text key and then discarded by the composer. The parser now splits text tokens on embedded Backspace/DEL control bytes outside bracketed paste mode, preserving the control key and the following composed text.Related Issue
Fixes #53982
Type of Change
Changes Made
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts: split plain text tokens around\band\x7fbefore passing each segment toparseKeypress().ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts: added regressions for\x7fô,\x7fôi, and embedded backspace text chunks.How to Test
npm run test --workspace ui-tui -- packages/hermes-ink/src/ink/parse-keypress.test.ts.npm run test --workspace ui-tui -- packages/hermes-ink/src/ink/parse-keypress.test.ts src/__tests__/textInputBurstInput.test.ts src/__tests__/textInputFastEcho.test.ts.npm run typecheck --workspace ui-tui.npm run lint --workspace ui-tui -- packages/hermes-ink/src/ink/parse-keypress.ts packages/hermes-ink/src/ink/parse-keypress.test.ts.Checklist
Code
pytest tests/ -qand all tests pass; N/A, this is a TUI TypeScript parser change, so targeted Vitest/typecheck/lint were run insteadDocumentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Validation run locally: