feat: copy text from panels [2] and [3] by selecting it with the mouse - #69
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
stanlyzoolo
added a commit
that referenced
this pull request
Aug 23, 2026
Follow-up to #69, which added drag-to-copy in [2]/[3] but left four claims stale and one dependency undocumented: - README Stack was missing atotto/clipboard, now a direct dependency - README's mouse bullet said "selection", ambiguous between the tool cursor and text selection - ARCHITECTURE still said a card link opens on click; it opens on Release without motion, never on Press, because the press anchors a drag - ARCHITECTURE had no drag-selection invariant at all - neither document listed the new writeClipboard test seam CLAUDE.md edits kept minimal: the file is at 147k of the 150k harness limit. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.
Text in
[2]and[3]was on screen but unreachable: the terminal's own selection is gone under the alt screen with mouse reporting on, so a version string, a command from a README fence or a release note could only be retyped by hand.Drag with the left button in the brief card or the docs panel to select, release to copy the plain text to the system clipboard. The status bar reports
copied N characters, orcopy failed: <err>when the clipboard write fails.How it works
handleSelectableMouse(render.go) is the shared driver for both panels:Pressanchors,Motionextends,Releasecopies. A drag belongs to the panel it was anchored in, so a release over[1]or outside the viewport still finalizes instead of strandingselActivewith the highlight frozen on screen.selPos{line, col}), not screen ones —YOffsetis added when mapping a row back to a line and never stored, so the selection survives scrolling.paintSelectionauto-scrolls at the window edges so a drag can extend past what is visible.beginSelectionsnapshots the panel's rendered lines (styled + ANSI-stripped) at press time, so a motion event repaints without re-rendering the card or the README.ansi.Cut+ reverse video, applied per whole line — the codebase's strip-then-repaint rule, so a cut can never land inside an escape sequence.Updatethread (copyCmd):clipboard.WriteAllshells out topbcopy/xclip/wl-clipboard/PowerShell and can block.Behavior changes
Release, not onPress— the press anchors a drag, and a drag starting on the repo line must copy rather than open the browser. Only a motion-less release opens the link.modeNormalonly, nothing while an overlay is up.github.com/atotto/clipboardmoves from indirect to a direct dependency.Tests
selection_test.gocovers copy on release, a drag starting on a link not opening it, an empty click copying nothing, a release outside the panel finalizing, and the overlay/non-normal gate.textutil_test.gocovershighlightLine,selectedTextandhighlightSelectionas pure functions;commands_test.godrives thecopyDoneMsghandler through thewriteClipboardseam.Preflight green: build, vet,
test -race, golangci-lint.