fix(web): bypass xterm for global terminal shortcuts#1580
Open
AriajSarkar wants to merge 4 commits intopingdotgg:mainfrom
Open
fix(web): bypass xterm for global terminal shortcuts#1580AriajSarkar wants to merge 4 commits intopingdotgg:mainfrom
AriajSarkar wants to merge 4 commits intopingdotgg:mainfrom
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 |
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 Changed
keybindingsstate down fromChatView.tsxintoThreadTerminalDrawer.tsx.attachCustomKeyEventHandleron the xterm.js instance to explicitly pass the shortcutcontext: { terminalFocus: true, terminalOpen: true }.falseon global shortcut matches (terminal.toggle,terminal.new,terminal.split,terminal.close,diff.toggle) to bypass xterm input capture.Why
When the terminal was focused,
xterm.jseagerly captured shortcut combinations (e.g., interceptingCtrl+Jas an0x0ALine Feed, orCtrl+Nas^N).This prevented the global application shortcut listeners in
ChatView.tsxfrom ever receiving these specific keystrokes. By explicitly whitelisting these application-level combinations in the custom event handler and providing the correctwhencontext, xterm safely ignores them and allows thekeydownevent to bubble up properly.Checklist
Note
Low Risk
Low risk UI behavior change limited to terminal key handling; primary risk is unintended shortcut passthrough or conflicts when the terminal is focused.
Overview
When the thread terminal is focused, xterm no longer swallows app-level shortcuts for
terminal.toggle,terminal.split,terminal.new,terminal.close, anddiff.toggle, allowing the global keydown handler to receive them.This wires resolved
keybindingsfromChatViewintoThreadTerminalDrawer/TerminalViewportand uses them inattachCustomKeyEventHandlerto explicitly bypass xterm for those shortcuts while keeping terminal navigation/clear handling unchanged.Written by Cursor Bugbot for commit ca579f7. This will update automatically on new commits. Configure here.
Note
Bypass xterm key handling for global terminal shortcuts when terminal is focused
keybindingsprop toTerminalViewport(viaThreadTerminalDrawer) so resolved keybindings flow fromChatViewdown to the xterm instance.attachCustomKeyEventHandler, key events matching toggle, split, new-tab, close, or diff shortcuts now returnfalse, preventing xterm from consuming them and allowing higher-level handlers to fire.Macroscope summarized ca579f7.