Skip to content

Conversation

@448523760
Copy link
Contributor

Summary

  • Shortcut toggle using ? in handle_shortcut_overlay_key fails to trigger on some platforms (notably Windows). Current match requires KeyCode::Char('?') with KeyModifiers::NONE. Some terminals set SHIFT when producing ? (since it is typically Shift + /), so the strict NONE check prevents toggling.

Impact

  • On Windows consoles/terminals, pressing ? with an empty composer often does nothing, leading to inconsistent UX compared to macOS/Linux.

Root Cause

  • Crossterm/terminal backends report modifiers inconsistently across platforms. Generating ? may include SHIFT. The code enforces modifiers == NONE, so valid ? presses with SHIFT are ignored. AltGr keyboards may also surface as ALT.

Repro Steps

  • Open the TUI, ensure the composer is empty.
  • Press ?.
  • Expected: Shortcut overlay toggles.
  • Actual (Windows frequently): No toggle occurs.

Fix Options

  • Option 1 (preferred): Accept ? regardless of SHIFT, but reject CONTROL and ALT.

    • Rationale: Keeps behavior consistent across platforms with minimal code change.
    • Example change:
      • Before: matching KeyModifiers::NONE only.
      • After: allow SHIFT, disallow CONTROL | ALT.
      • Suggested condition:
         let toggles = matches!(key_event.code, KeyCode::Char('?'))
         		&& !key_event.modifiers.intersects(KeyModifiers::CONTROL | KeyModifiers::ALT)
         		&& self.is_empty();
  • Option 2: Platform-specific handling (Windows vs non-Windows).

    • Implement two variants or conditional branches using #[cfg(target_os = "windows")].
    • On Windows, accept ? with SHIFT; on other platforms, retain current behavior.
    • Trade-off: Higher maintenance burden and code divergence for limited benefit.

close #5495

- Allow `?` toggling with or without `SHIFT`, rejecting `CONTROL` and `ALT`.
- Ensures consistent behavior across platforms where `SHIFT` reporting varies.

close openai#5495
@etraut-openai
Copy link
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@etraut-openai
Copy link
Collaborator

Thanks for the contribution. Good analysis and solid fix.

@etraut-openai etraut-openai merged commit 28dcdb5 into openai:main Dec 4, 2025
26 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"? for shortcuts" not working on windows11

2 participants