feat(cli): support middle-click paste / 支持 CLI 中键粘贴 - #6589
Merged
SivanCola merged 3 commits intoJul 19, 2026
Conversation
ffff2004
force-pushed
the
feat/middle-click-primary-paste
branch
2 times, most recently
from
July 17, 2026 14:11
383c294 to
61270b7
Compare
ffff2004
force-pushed
the
feat/middle-click-primary-paste
branch
2 times, most recently
from
July 18, 2026 15:31
61a89f8 to
b9609af
Compare
Add pastePrimary() that reads from the X11/Wayland PRIMARY selection (via wl-paste --primary, xclip -selection primary -o, or xsel --output --primary) and wire it to the MouseMiddle event in the TUI. Previously, with mouse capture enabled, middle-click was consumed but not handled, silently breaking the terminal convention of PRIMARY paste. Now it works correctly: PRIMARY content is pasted into the composer, and an empty PRIMARY is a silent no-op.
ffff2004
force-pushed
the
feat/middle-click-primary-paste
branch
from
July 19, 2026 06:36
b9609af to
424d20d
Compare
Problem: Middle-click paste could expose credential-store variables to clipboard helpers, mutate a hidden composer, read PRIMARY on an SSH host, and alter selected text. Root cause: The new subprocesses inherited the full process environment, while the mouse and PRIMARY paths bypassed existing ownership, remote-session, and byte-preservation contracts. Fix: Filter every paste helper through secrets.ProcessEnv, respect tmux/SSH/composer boundaries, request text explicitly, preserve selection bytes, and add focused regression coverage. Verification: - go test ./internal/cli - go test -race ./internal/cli - go vet ./... - git diff --check Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
SivanCola
enabled auto-merge (squash)
July 19, 2026 11:40
This was referenced Jul 19, 2026
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.
Summary
Restore conventional middle-click paste while the Reasonix CLI owns terminal
mouse events.
behavior.
wl-paste,xclip, orxsel.probing the remote host's graphical selection.
hidden.
Security and correctness
secrets.ProcessEnv()so registeredcredential-store variables are not inherited by subprocesses.
wl-paste.newlines.
Verification
go test ./internal/cligo test -race ./internal/cligo vet ./...git diff --checkorigin/main-v2: focused and race CLI testspassed
Compatibility
Cache impact
serialization paths changed.