Repository navigation
fix: support Linux middle-click selection paste - #18
Conversation
Read PRIMARY on middle-click and insert its text at the clicked caret position without replacing another selection or sending a message. Publish mouse and keyboard text selections to PRIMARY, preserving the separate Copy/Paste clipboard and leaving empty selections alone. Cover insertion, undo, empty selections, and single-line normalization with regressions, and document the Linux selection behavior. Co-Authored-By: GPT-6 <noreply@openai.com>
itz4blitz
left a comment
There was a problem hiding this comment.
Middle-click paste itself is right: PRIMARY is read before the caret moves, place then insert keeps an existing selection, empty PRIMARY is a no-op, and the clipboard stays separate.
One change before this can merge. on_mouse_down now sets is_selecting for every left click, including double-click and triple-click. on_mouse_move then calls select_to, whose anchor is the start of the word or line. A move event at the click point, which GPUI sends, shrinks that selection to word_start..click before mouse-up. Keep is_selecting only on the plain-click arm, and call publish_primary directly from the shift, double-click, and triple-click arms (mouse-up still covers a drag).
|
The review above is the change to make. Windows also failed |
Only plain clicks start a selection drag. Publish Shift-click, word, and line selections immediately so a stationary mouse-move event does not shrink them before release. Keep publishing completed drags on mouse-up and cover each selection mode with a regression test. Update the Composer specification to describe when PRIMARY is published. All five input tests pass. Co-Authored-By: GPT-6 <noreply@openai.com>
The Slack adapter commits followed status before unread counts. Waiting only for followed can observe the intermediate zero count, which failed Windows CI. Wait for both updates before checking the completed thread. Co-Authored-By: GPT-6 <noreply@openai.com>
itz4blitz
left a comment
There was a problem hiding this comment.
The follow-up does what the review asked. select_on_press returns true only for a plain click, so a move at the same point cannot run select_to over a word, line, or Shift-click selection, and those publish PRIMARY on press. The Slack test now waits until the followed thread's unread count is committed, which is the assertion Windows was failing. macOS, Linux, and Windows are green on 52083b2.
The message field handled keyboard paste but had no middle-click handler, so selecting a link in another application and middle-clicking the composer did nothing on Linux.
Read Linux PRIMARY on middle-click, focus the field, and insert text at the clicked position without replacing another selected range or sending a message. Read the selection before moving the caret so a field can paste its own selected text. Publish completed mouse selections and keyboard selections to PRIMARY so text selected in tinyclient can also be pasted elsewhere. Empty selections leave the draft unchanged. The regular Copy/Paste clipboard remains separate; single-line fields normalize pasted newlines.
Based directly on upstream
main, independently of the keyboard shortcut and sidebar PRs. Uses GPUI's existing PRIMARY API; no helper commands or new dependencies.Review correction: only a plain left click starts a drag. Word, line, and Shift-click selections publish PRIMARY immediately, preserving their complete range when GPUI delivers a stationary mouse-move event. Completed drags still publish on release.
The previous Windows failure was in an unrelated Slack integration test: followed status is committed before unread counts, but the test asserted the count as soon as followed appeared. Its wait now requires both updates before the assertion.
Validation:
git diff --checkpasses. Interactive Wayland middle-click behavior has not yet been verified locally.