fix(simulation): normalize named key presses#37523
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Make
ui.pressinterpret lowercase semantic key names such asescapethrough OpenTUI's named-key table instead of typing the name as literal text.Closes #37511.
Before / After
Before:
ui.press({ key: "escape" })forwardedescapedirectly to OpenTUI's case-sensitive test input API, which emitted the seven literal characters. Callers had to send the raw escape byte instead.After: recognized named keys are normalized to OpenTUI's canonical token (
escapetoESCAPE) at the adapter boundary. Printable input such asxremains unchanged, and key modifiers are preserved.How
packages/simulation/src/frontend/actions.tschecks the uppercased semantic name against OpenTUI's installedKeyCodestable before pressing it.packages/simulation/test/actions.test.tscovers named-key normalization, modifier forwarding, and printable-key preservation throughSimulationActions.execute.Scope
The simulation protocol remains
key: string; this does not add aliases or invent terminal sequences for names absent from OpenTUI's key table.Testing
bun testinpackages/simulation: 27 passedbun run typecheckinpackages/simulation