Fix focused terminal toggle shortcut handling on Windows#2670
Fix focused terminal toggle shortcut handling on Windows#2670justsomelegs wants to merge 4 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved Straightforward bug fix for Windows keyboard shortcut handling. The production change adds ~10 lines to extract key letters from event codes when control characters are sent, with comprehensive test coverage across platforms. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate 9bbfd40
What Changed
Fixed the terminal toggle shortcut so keybinds like
Ctrl+Jworks reliably when focus is inside the embedded terminal on Windows.The change keeps
event.keymatching as the primary path, but adds a narrow fallback forKeyA-KeyZphysical key codes so modified shortcuts likeCtrl+Jstill resolve when xterm/Chromium reports the focused-terminal event as a control character instead of"j".Also added regression coverage for:
Cmd+J, LinuxCtrl+J, and WindowsCtrl+JWhy
On Windows, pressing
Ctrl+Jwhile the terminal was focused sent the control character to the terminal instead of closing the drawer. The terminal toggle shortcut already had the right ownership model, but the keybinding matcher was too dependent onevent.keyfor modified letter shortcuts.This approach is the smallest fix:
Cmd/Ctrl+JUI Changes
Not applicable. No visual UI changes.
Checklist
Note
Fix focused terminal toggle shortcut handling on Windows for control-character key events
Ctrl+Jfires a keyboard event withkey: '\n'(a control character) rather than'j', causing the terminal toggle shortcut to go unrecognized.eventCodeAliasesin keybindings.ts to derive a lowercase letter alias fromevent.code(e.g.KeyJ→'j'), and updatesresolveEventKeysto use it so control-character events are matched correctly.falseforterminal.toggleevents, yielding them back to the app instead of consuming them.Macroscope summarized 52347e9.