feat(editor): add explicit macOS clipboard commands - #182
Merged
Conversation
Greptile SummaryAdds explicit macOS clipboard integration to the editor.
Confidence Score: 5/5The PR appears safe to merge; no actionable correctness, security, or repository-rule violations were identified. Clipboard operations are explicit, bounded, validated before application, and tested across editor, prompt, failure, timeout, and cleanup paths without an established behavioral regression.
|
| Filename | Overview |
|---|---|
| src/clipboard.rs | Implements bounded nonblocking clipboard subprocess I/O, validation, timeout cleanup, and focused adapter tests. |
| src/app.rs | Integrates copy and paste commands into editor and prompt flows while preserving expected edit, selection, and error behavior. |
| src/keymap.rs | Adds the M-w copy binding and C-c C-v clipboard-paste prefix. |
| src/buffer.rs | Exposes Rope range byte length so copy limits can be checked before materializing selected text. |
| src/command_registry.rs | Registers the clipboard commands and the clipboard-copy alias. |
Reviews (1): Last reviewed commit: "feat(editor): add explicit macOS clipboa..." | Re-trigger Greptile
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.
M-w copies the active region to the macOS clipboard without deleting text or changing the selection or kill ring. C-c C-v and clipboard-paste insert literal clipboard text as one edit; the shortcut also works inside editable prompts without submitting them. copy-region has the clipboard-copy alias.
The adapter invokes fixed pbcopy/pbpaste paths only on explicit commands. Nonblocking pipe I/O and child exit polling share a two-second deadline, transfers are capped at 16 MiB, invalid UTF-8 is rejected, and failures kill and reap children without editing the buffer. Copy checks the Rope range size before materializing it. Prompt errors preserve the entered text and clear on the next key, including an empty successful retry.
Validation: formatting, strict all-target Clippy, release build, and 388 unit tests pass. Ten focused clipboard tests use controlled executable adapters and cover exact UTF-8 transfer, copy/paste keys and aliases, prompt behavior, failures, size limits, timeouts, and process cleanup. Eleven of thirteen terminal integration tests pass locally; the two existing redirected-input tests remain sandbox-restricted and require macOS CI. Fresh review approved after the empty-retry regression was reproduced and fixed.
Manual limit: the native pbcopy command exits 1 in this environment before Cortex is involved, so a successful system clipboard round trip could not be verified here. The release PTY check verified visible paste errors in the editor and command prompt, preserved text and entered commands, save, quit, and shell restoration. Successful copy/paste behavior is verified with controlled adapters.
Closes #167.