Repository navigation
feat(screenshot): add Ctrl+C shortcut to copy w/o saving - #3645
Conversation
Add Ctrl+C shortcut in interactive region selection mode to immediately copy the current selection (or hovered snap target) to clipboard without saving to a file. - Works during mid-drag, on hovered targets, or on existing selections - Bypasses file saving and forces clipboard output - Emits aborted status in JSON mode so external callers (such as Quick Capture) exit cleanly without launching an annotation editor - Exits cleanly without error if triggered with no selection - Updates HUD items with Ctrl+C copy shortcut - Hides corner resize handles and maintains crosshair cursor while dragging with Ctrl held
|
/claude review |
| } | ||
| } | ||
|
|
||
| if result.CopyOnly { |
There was a problem hiding this comment.
With --stdout, Ctrl+C never reaches the clipboard: the config.Stdout branch right below writes the image to stdout and returns before config.Clipboard is checked. The user presses Ctrl+C and nothing is copied. Clear Stdout here too.
| if result.CopyOnly { | |
| if result.CopyOnly { | |
| config.SaveFile = false | |
| config.Stdout = false |
| r.selection.dragging = false | ||
| r.movingSelection = false | ||
| r.resizingHandle = handleNone | ||
| r.copyOnly = true |
There was a problem hiding this comment.
In scroll mode, finishSelection() doesn't capture anything. It calls enterScrollPhase and returns, so Ctrl+C during scroll-mode selection just starts scrolling. copyOnly stays true, though, so a later plain Enter/"done" in the scroll phase also skips saving and reports aborted. Either skip copyOnly when r.screenshoter.config.Mode == ModeScroll in this branch, or reset r.copyOnly = false in enterScrollPhase. The same applies to the two snap-target branches above.
Claude reviewOverall the change works. Two edge cases leave Ctrl+C in a wrong state.
|
- Disable stdout output when copyOnly is active to ensure the image is copied to the clipboard instead of being written to stdout. - Write 'Copied to clipboard' to stderr if --stdout was originally passed. - Bypass entering scrollPhase in finishSelection() if copyOnly is set, immediately capturing and copying the selected region.
|
/claude review |
Claude reviewNo issues found. Both earlier findings are fixed: copy-only now clears |
What
Adds
Ctrl+Cshortcut in interactive region screenshot mode (dms screenshot region):status: "aborted"in--jsonmode so external callers (such as annotation plugins) exit cleanly without launching an editor.Esc).Suppresses the 4 corner resize handles and maintains the crosshair cursor while dragging with
Ctrlheld.Displays
Ctrl+C copyin the region HUD hint list.Why
Related to #1528. Previously, screenshots could not be copied on the fly without saving when default or caller flags enabled file saving.
Sidenote
I didn't add
Ctrl+Shere since I still can't figure out how to handle the case where a user specifies a directory and pressesCtrl+S. Should it save to the default directory or the specified directory?So I just limited the scope to
Ctrl+Chere.