Skip to content

fix(simulation): normalize named key presses#37523

Merged
kitlangton merged 1 commit into
v2from
fix/simulation-special-keys
Jul 17, 2026
Merged

fix(simulation): normalize named key presses#37523
kitlangton merged 1 commit into
v2from
fix/simulation-special-keys

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Make ui.press interpret lowercase semantic key names such as escape through OpenTUI's named-key table instead of typing the name as literal text.

Closes #37511.

Before / After

Before: ui.press({ key: "escape" }) forwarded escape directly 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 (escape to ESCAPE) at the adapter boundary. Printable input such as x remains unchanged, and key modifiers are preserved.

How

  • packages/simulation/src/frontend/actions.ts checks the uppercased semantic name against OpenTUI's installed KeyCodes table before pressing it.
  • packages/simulation/test/actions.test.ts covers named-key normalization, modifier forwarding, and printable-key preservation through SimulationActions.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 test in packages/simulation: 27 passed
  • bun run typecheck in packages/simulation
  • Pre-push workspace typecheck: 32 packages passed

@kitlangton
kitlangton merged commit 3fc06ac into v2 Jul 17, 2026
9 checks passed
@kitlangton
kitlangton deleted the fix/simulation-special-keys branch July 17, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant