Skip to content

tui: accept AltGr (Ctrl+Alt) printable chars on Windows, fixes brace … - #3154

Closed
AjayKumbham wants to merge 2 commits into
openai:mainfrom
AjayKumbham:fix/tui-windows-altgr-braces-3092
Closed

AjayKumbham wants to merge 2 commits into
openai:mainfrom
AjayKumbham:fix/tui-windows-altgr-braces-3092

Conversation

@AjayKumbham

Copy link
Copy Markdown

Summary

  • Fix Windows inability to type or paste {} (and other AltGr characters) in the Codex TUI input.

What

  • Update codex-rs/tui/src/bottom_pane/textarea.rs to treat printable Ctrl+Alt key chords (AltGr) as normal character input on Windows:
    • On #[cfg(windows)], when receiving KeyCode::Char(c) with KeyModifiers::CONTROL | KeyModifiers::ALT and c is non‑alphanumeric, insert c into the composer.

Why

  • On Windows layouts, { and } are often produced via AltGr. Crossterm reports AltGr as Ctrl+Alt, which our input previously treated as a control chord instead of printable text. This resulted in braces being dropped when typed or pasted.
  • Resolves #3092.

How

  • Minimal, targeted change in the TUI input path:
    • Added a Windows-only early check at the start of TextArea::input() to handle AltGr as printable for non‑alphanumeric characters (e.g., {, }, @, etc.).
    • Preserves existing shortcuts like Ctrl+Alt+H (delete word) by limiting this to non‑alphanumeric characters only.

Impact

  • Windows users can type and paste braces and other AltGr characters correctly in the composer.
  • No behavior changes on macOS/Linux.
  • No regression to word-delete or other control bindings.

Testing

  • Unit tests for TUI pass locally.
  • Manual checks recommended on Windows:
    • Type { and } with your keyboard layout’s AltGr chord.
    • Paste JSON like {"detail":"Unauthorized header"} and confirm braces are preserved.
    • Validate Ctrl+Alt+H still deletes the previous word.

Files Changed

  • codex-rs/tui/src/bottom_pane/textarea.rs

Related Issues

  • Fixes #3092.

Checklist

  • Minimal, focused change
  • Windows‑only behavior behind #[cfg(windows)]
  • Preserves existing shortcuts
  • References linked issue

@AjayKumbham AjayKumbham closed this by deleting the head repository Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant