Skip to content

Select a word on double-click and a line on triple-click; Shift-drag over a mouse program selects - #1475

Draft
nedtwigg wants to merge 4 commits into
mainfrom
issue-85-double-click-select
Draft

nedtwigg wants to merge 4 commits into
mainfrom
issue-85-double-click-select

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Select a word on double-click and a line on triple-click

A double-click in a terminal that is not reporting the mouse painted xterm.js's own word selection: a different look from the terminal's selection, and one Cmd+C never copied. The mouse router consumed a press only while the program reported the mouse, so with reporting off every press also reached xterm's SelectionService, which selects on a multi-click (and extends on a Shift-click) by itself. Drags never showed it only because the router swallowed their moves.

The router now owns multi-clicks the terminal owns: a double-click selects the token under it (the cells Whole words grows over), a triple-click its logical line, both as the terminal's selection, with the copy editor opening on release as after a drag. A press it owns stops at xterm's screen element when it is a multi-click or a Shift-click, after the linkifier there has seen it, so xterm's selection never sees it and a link's double-click still pins its preview. A double-click on a link or a blank selects nothing.

Take a Shift-drag over a mouse program as the terminal's selection

Off macOS, xterm.js treats a Shift-held press as a forced selection, even while the program reports the mouse. The router left that press to the program, so xterm painted its own selection over a shadowed drag: not the terminal's selection, and not one Cmd+C or Ctrl+C copied.

The router now owns a Shift-held primary press over a reporting program off macOS. That gives a Shift-drag the terminal's own selection and copy editor, and keeps every event from the program and from xterm. Whether a gesture's events are kept from xterm is now decided at its press and held until its release. Before, it was worked out again on each event from the store, so a Shift-click's release (and a scrollback press's moves before it became a drag) still reached xterm and the program. That leaves stateRequiresNativeMouseSuppression unused, so it is removed.

The sweep for other ways xterm's own selection could win found one more: macOS right-click selected a word (rightClickSelectsWord defaults on there). The terminal now turns that off, and pins Option-click forced selection off too.

The Shift-drag behavior on Windows/Linux follows the maintainer's decision. Side effect for review: a Shift-click inside a mouse-reporting program on Windows/Linux no longer reaches the program. macOS is unchanged.

Approve the new Argos snapshot. Main, including #1466 (quote rewrap), is merged in. A double-click on a quoted line still selects just the word; a triple-click covers the whole line, quote prefix included, which Auto writes as Markdown > as it would for a drag.

Fixes #85

🤖 Generated with Claude Code

nedtwigg and others added 2 commits October 30, 2026 13:25
A double-click in a terminal that is not reporting the mouse painted
xterm.js's own word selection: a different look from the terminal's
selection, and one Cmd+C never copied. The mouse router consumed a press
only while the program reported the mouse, so with reporting off every
press also reached xterm's SelectionService, which selects on a
multi-click (and extends on a Shift-click) by itself. Drags never showed
it only because the router swallowed their moves.

The router now owns multi-clicks the terminal owns: a double-click
selects the token under it (the cells Whole words grows over), a
triple-click its logical line, both as the terminal's selection, with
the copy editor opening on release as after a drag. A press it owns
stops at xterm's screen element when it is a multi-click or a
Shift-click, after the linkifier there has seen it, so xterm's selection
never sees it and a link's double-click still pins its preview. A
double-click on a link or a blank selects nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Off macOS, xterm.js treats a Shift-held press as a forced selection,
even while the program reports the mouse. The router left that press to
the program, so xterm painted its own selection over a shadowed drag:
not the terminal's selection, and not one Cmd+C or Ctrl+C copied.

The router now owns a Shift-held primary press over a reporting program
off macOS. That gives a Shift-drag the terminal's own selection and copy
editor, and keeps every event from the program and from xterm. Whether
a gesture's events are kept from xterm is now decided at its press and
held until its release. Before, it was worked out again on each event
from the store, so a Shift-click's release (and a scrollback press's
moves before it became a drag) still reached xterm and the program.
That leaves stateRequiresNativeMouseSuppression unused, so it is
removed.

The sweep for other ways xterm's own selection could win found one
more: macOS right-click selected a word (rightClickSelectsWord defaults
on there). The terminal now turns that off, and pins Option-click
forced selection off too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: f7494b5
Status: ✅  Deploy successful!
Preview URL: https://98f4388c.mouseterm.pages.dev
Branch Preview URL: https://issue-85-double-click-select.mouseterm.pages.dev

View logs

Resolve scripts/spec-word-budgets.json by taking the larger budget per spec, then ratchet docs/specs/mouse-and-clipboard.md, since both sides added words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #1487's story-clock fix for the access-log story, which is the one changed Argos snapshot every open PR showed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Double-click to select text is broken

1 participant