Skip to content

fix: support Linux middle-click selection paste - #18

Merged
itz4blitz merged 3 commits into
itz4blitz:mainfrom
vbmithr:fix/linux-primary-paste
Oct 17, 2026
Merged

itz4blitz merged 3 commits into
itz4blitz:mainfrom
vbmithr:fix/linux-primary-paste

Conversation

@vbmithr

@vbmithr vbmithr commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Five input tests pass, including regressions covering insertion with an existing selection, Unicode text, undo, empty/missing selections, single-line normalization, and word/line/Shift-click selections surviving a stationary mouse move.
  • The previously failing Slack integration test passes locally with the corrected wait.
  • Arch package revision 16 includes the review correction.
  • git diff --check passes. Interactive Wayland middle-click behavior has not yet been verified locally.

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>
@vbmithr
vbmithr requested a review from itz4blitz as a code owner October 17, 2026 15:51

@itz4blitz itz4blitz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread crates/tinyclient/src/gui/input.rs Outdated
@itz4blitz

Copy link
Copy Markdown
Owner

The review above is the change to make. Windows also failed info_mute_pins_files_emoji_threads_and_a_scheduled_send_ask_slack_once_each in crates/chatd/tests/slack.rs (left: 0, right: 1). #10 failed that same assertion and neither branch touches the test, so it is not part of this review.

vbmithr and others added 2 commits October 17, 2026 18:02
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 itz4blitz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@itz4blitz
itz4blitz merged commit 712e2db into itz4blitz:main Oct 17, 2026
3 checks passed
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.

2 participants