-
Notifications
You must be signed in to change notification settings - Fork 42
🤖 feat: add platform-native clipboard shortcuts to terminal #1563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4309532 to
62a0b3a
Compare
ammar-agent
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed: added documentation with VS Code reference link explaining the platform conventions.
|
@codex review |
|
Addressed: fixed the comment - Windows Ctrl+C does send interrupt signals. The behavior is copy-when-selection-exists (same as VS Code), otherwise SIGINT. |
62a0b3a to
252bf89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62a0b3af40
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
252bf89 to
13582f6
Compare
|
Addressed: switched from |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13582f6249
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
13582f6 to
7a3655d
Compare
|
Addressed: switched to |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a3655df37
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Implement copy/paste keyboard shortcuts in the terminal that match platform conventions: - macOS: Cmd+C/V (standard Mac shortcuts) - Linux: Ctrl+Shift+C/V (standard terminal shortcuts, preserves Ctrl+C for SIGINT) - Windows: Ctrl+C/V (standard Windows shortcuts) Uses ghostty-web's attachCustomKeyEventHandler() to intercept shortcuts and call the clipboard API directly, since the Electron Edit menu paste role doesn't reach ghostty-web's hidden textarea.
|
Addressed: Linux Ctrl+Shift+C is now always swallowed (no-op if no selection) to prevent it from propagating as SIGINT. Mac/Windows only intercept when there's a selection. |
7a3655d to
72d35cf
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
The attachCustomKeyEventHandler in ghostty-web returns: - true: PREVENT default handling (we handled it) - false: ALLOW default handling (let ghostty process it) The clipboard shortcut handler (#1563) had this inverted, returning true for all non-keydown events and at the end of the handler, which prevented ghostty from processing any keyboard input. Fixes terminal input regression introduced in d3928b5.
…1586) ## Summary Fixes terminal input regression introduced in #1563 (d3928b5). ## Root Cause The `attachCustomKeyEventHandler` in ghostty-web returns: - `true`: **PREVENT** default handling (we handled it) - `false`: **ALLOW** default handling (let ghostty process it) The clipboard shortcut handler had this inverted: - Returned `true` for all non-keydown events → blocked keyup/keypress - Returned `true` at end of handler → blocked all normal key input This effectively disabled all terminal input except the specific copy/paste shortcuts. ## Fix Invert all return values to match ghostty-web's API contract. --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high` • Cost: `$2.53`_
Summary
Implement copy/paste keyboard shortcuts in the terminal (RightSidebar) that match platform conventions:
Problem
Cmd/Ctrl+V paste didn't work in the terminal. The terminal uses ghostty-web which has paste support via a hidden textarea, but Electron's Edit menu
role: "paste"usesexecCommand('paste')on the focused element—and ghostty-web focuses the container div, not the textarea.Solution
Use ghostty-web's
attachCustomKeyEventHandler()API to intercept platform-appropriate shortcuts and call the Clipboard API directly.Key behaviors:
terminal.paste()which handles bracketed paste mode correctlyTesting
Generated with
mux• Model:anthropic:claude-opus-4-5• Thinking:high• Cost:$3.87