Repository navigation
fix(terminal): restore Ctrl+Shift+C copy and copy on Ctrl+C with selection on Windows - #1978
Merged
Merged
Conversation
…ction on Windows (#1970) - Scope browser pane commands in plugins/browser/init.luau with enabled = function() return Browser:Focused() ~= nil end (matching packages/gui-plugins/src/browser/renderer.tsx scope: "#browser-panel"), include browser editor focus in Dep::Browser, and skip dormant browser pane-scoped commands in plugin_host::commands::takes_chord so browser.inspect (mod+shift+c) does not intercept Ctrl+Shift+C in the terminal on Windows and Linux. - Evaluate plugin_takes_chord alongside takes_from_pane inside terminal_surface::input::dispatch_key (after terminal-owned bindings such as TerminalCopy, TerminalPaste, and Find) and consume Ctrl+Shift+C with no selection instead of forwarding SIGINT. - On Windows, copy and clear the active terminal selection on Ctrl+C (matching Windows Terminal, VS Code, and Edit > Copy), while preserving Ctrl+C SIGINT when nothing is selected. - List ctrl+shift+c first on Windows and Linux for Bind::TerminalCopy (matching Bind::TerminalPaste).
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
Fixes #1970
Problem
On Windows (and Linux), pressing
Ctrl+Shift+Cin the built-in terminal did nothing, and pressingCtrl+Cafter selecting text cleared the selection and sentSIGINTinstead of copying:Ctrl+Shift+Cwas intercepted beforeBind::TerminalCopy:side_ops::key_terminalcheckedhost.plugin_takes_chord(ev, tx)before callinginput::dispatch_key.plugins/browser/init.luauregisteredbrowser.inspect(mod+shift+c, which resolves toCtrl+Shift+Con Windows/Linux) and other pane-scoped commands without anenabledguard.takes_chordtherefore yieldedCtrl+Shift+Cout of the terminal even when no browser tab was focused or open;browser.inspectthen declined becauseBrowser:Focused()wasnil, silently dropping the shortcut.Ctrl+Cwith a selection on Windows did not copy:input::dispatch_keyonly matchedBind::TerminalCopy(super+c, ctrl+shift+c), soCtrl+C(and the Windows app menu'sEdit > Copy) always forwarded^Cto the PTY even with text selected.Changes
plugins/browser/init.luau&apps/desktop/src/plugin_host/native/browser.rs: Addenabled = function() return Browser:Focused() ~= nil endto pane-scoped browser commands (matching officialpackages/gui-plugins/src/browser/renderer.tsxscope: "#browser-panel") and hasheditors::plugin_focused(app, "browser")inDep::Browser.apps/desktop/src/plugin_host/bridge/commands.rs: Skip dormant browser pane-scoped commands (those with a recordedenabledfunction) intakes_chord, respect Settings › Shortcuts overrides (overrides::command), and continue to subsequent matching plugin commands if an earlier command declines.features/terminal-surface/src/side_ops.rs&features/terminal-surface/src/input.rs: Checkplugin_takes_chordalongsidetakes_from_paneinsidedispatch_key(after terminal-owned bindings such asTerminalCopy,TerminalPaste, and Find); consumeCtrl+Shift+Cwithout sendingSIGINTwhen nothing is selected (matching officialterminal.tsx:477); and on Windows copy + clear selection onCtrl+Cwhen text is selected while preservingCtrl+CSIGINTwhen nothing is selected.crates/opencode-ui/src/keymap/mod.rs: Orderctrl+shift+cbeforesuper+con Windows and Linux forBind::TerminalCopy, matchingBind::TerminalPaste.Verification
pwsh scripts/guardrails.ps1(11/11).cargo check -p opencode-ui -p opencode-feature-terminal-surface -p opencode-desktop --lib --bins.cargo clippy -p opencode-ui -p opencode-feature-terminal-surface -p opencode-desktop --lib --bins --no-depswith zero diagnostics in modified lines.