Skip to content

Transcript: double-click drags keep selecting whole words - #643

Open
dfrnoch wants to merge 1 commit into
zeronsh:mainfrom
dfrnoch:fix-double-click-word-select
Open

dfrnoch wants to merge 1 commit into
zeronsh:mainfrom
dfrnoch:fix-double-click-word-select

Conversation

@dfrnoch

@dfrnoch dfrnoch commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor
  • Double-clicking chat text selected the word, but the selection was stored as a normal drag starting at the word's first letter. Any mouse move before release, even slight tremor, re-resolved it letter by letter from there to the pointer. The word collapsed to a few letters and the gesture behaved like a plain drag. Triple-click had the same problem.
  • The selection now remembers it started as a double- or triple-click. While the drag lasts, the pointer end snaps to word boundaries (double-click) or whole text elements, i.e. paragraphs, list items and code lines (triple-click). The clicked unit stays selected in either direction, matching the composer and native text fields.
  • Also applies when the drag auto-scrolls far enough that the starting row leaves the virtualized list.
  • Rendered markdown in the file preview uses the same selection code and gets the fix too.
  • Worth a look: this touches the same render.rs mouse-down listener as open PR Fix transcript selection leaking through popups #556. The overlap is small, only the begin_with_span call sites.

Test plan

  • markdown::render::tests::code_block_lines_participate_in_text_selection now moves the pointer after a double-click. Fails without the fix ("s" instead of "selectable"), passes with it
  • selection::tests::double_click_drag_extends_by_whole_words: tremor keeps the word; dragging forward, backward and into the next element extends by words
  • selection::tests::triple_click_drag_extends_by_whole_elements
  • selection::tests::word_drag_snaps_after_the_anchor_virtualizes
  • cargo test --locked -p zeron-ui --lib -- --test-threads=1
  • cargo clippy -p zeron-ui --all-targets: no new warnings in touched code
  • Manual: double-click a word in an agent reply, then double-click and drag across words and messages

Video preview (This PR vs latest release build)

8mb.video-ci2-LPjtURm7.mp4

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

A double click selected the word, but the selection was stored as an
ordinary drag anchored at the word's start. The next mouse move with the
button still down, even a pixel of tremor before release, re-resolved it
as a character range from that anchor to the pointer, so the word
collapsed to a few letters and the gesture behaved like a plain drag.

Record the multi-click unit with the drag. While it lasts, the head snaps
to word (double click) or element (triple click) boundaries and the
anchor unit stays selected in either direction, matching the composer
and native text. The virtualized path snaps the head the same way once
the anchor row scrolls away. Rendered markdown in the file preview uses
the same code and gets the same fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dfrnoch
dfrnoch force-pushed the fix-double-click-word-select branch from 9895d29 to b803b70 Compare September 29, 2026 23:22
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.

1 participant