Skip to content

fix: claim Wayland PRIMARY selection on mouse release#1626

Open
nikicat wants to merge 2 commits into
raphamorim:mainfrom
nikicat:fix/wayland-primary-selection
Open

fix: claim Wayland PRIMARY selection on mouse release#1626
nikicat wants to merge 2 commits into
raphamorim:mainfrom
nikicat:fix/wayland-primary-selection

Conversation

@nikicat
Copy link
Copy Markdown

@nikicat nikicat commented May 30, 2026

Summary

Selecting text in Rio never claimed the Wayland PRIMARY selection, so
middle-click and Shift+Insert pasted whatever other application last owned
PRIMARY instead of the text just selected. Every other Wayland terminal
populates PRIMARY on mouse selection independently of copy-on-select; do the same.

Details

  • On mouse release with a Left/Right button, claim ClipboardType::Selection
    regardless of copy_on_select (no-op on macOS/Windows where there is no
    primary selection). copy_on_select still independently drives the regular
    clipboard.
  • The mouse-release clipboard-targeting policy is extracted into a pure helper
    (copy_selection_on_pointer_release) with a unit test asserting PRIMARY is in
    the target set regardless of copy_on_select, locking the fix against future
    refactors.

Testing

cargo test -p rioterm; manual: select in Rio, middle-click / Shift+Insert in
another window pastes Rio's selection.

Closes #1620

🤖 Generated with Claude Code

nikicat and others added 2 commits May 30, 2026 17:37
Selecting text in Rio never claimed the primary selection, so middle-click
and Shift+Insert pasted whatever other application last owned PRIMARY
instead of the text just selected. Every other Wayland terminal populates
PRIMARY on mouse selection independently of copy-on-select; do the same.

Closes raphamorim#1620

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 8cfb10e)
Extract the mouse-release clipboard-targeting policy into a pure helper
and assert that PRIMARY is in the target set regardless of copy_on_select.
Locks in the fix for raphamorim#1620 against future refactors of the mouse-release
event handler.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 842b497)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Wayland: mouse selection is not exported to the PRIMARY selection (middle-click / Shift+Insert never paste Rio's own selection)

1 participant