Select and copy message text with the mouse (channel list and thread panel) #946

Closed
opened 2026-11-19 08:32:42 +00:00 by charles · 3 comments
Owner

Forum report from Charles (2026-11-19): "I can't select text in a sidebar thread."

What happens: in a thread shown in the side panel, message text cannot be selected with the mouse (and so cannot be copied), while it can in the main channel view.

Expected: the same text selection and copy behaviour as in the channel's message list.

Where to look: how the channel message list enables selection and whether the thread side panel renders messages through the same selectable text widgets and receives the same pointer events.

Forum report from Charles (2026-11-19): "I can't select text in a sidebar thread." **What happens:** in a thread shown in the side panel, message text cannot be selected with the mouse (and so cannot be copied), while it can in the main channel view. **Expected:** the same text selection and copy behaviour as in the channel's message list. **Where to look:** how the channel message list enables selection and whether the thread side panel renders messages through the same selectable text widgets and receives the same pointer events.
charles changed title from Text cannot be selected in a thread opened in the side panel to Select and copy message text with the mouse (channel list and thread panel) 2026-11-19 08:34:50 +00:00
charles added
task
and removed
bug
labels 2026-11-19 08:34:50 +00:00
Author
Owner

Investigation (2026-11-19): this is not specific to the thread side panel. Message text cannot be selected with the mouse anywhere in the client: bodies are drawn by the custom InlineFlow widget and iced's rich_text, neither of which supports selection (crates/fluxer-ui/src/widgets/inline_flow.rs header lists it as not supported), and the panel renders through the same message list code as the channel. So this is a feature to build, not a panel bug: a selection model, hit-testing and highlight in InlineFlow (plus the rich_text and code-block paths), Ctrl+C and a Copy entry using the selection, clearing on click elsewhere or Escape, and goldens for the highlight.

Open decision for Charles: selection inside one message only (smaller), or across messages like the web client.

Investigation (2026-11-19): this is not specific to the thread side panel. Message text cannot be selected with the mouse anywhere in the client: bodies are drawn by the custom `InlineFlow` widget and iced's `rich_text`, neither of which supports selection (`crates/fluxer-ui/src/widgets/inline_flow.rs` header lists it as not supported), and the panel renders through the same message list code as the channel. So this is a feature to build, not a panel bug: a selection model, hit-testing and highlight in `InlineFlow` (plus the `rich_text` and code-block paths), Ctrl+C and a Copy entry using the selection, clearing on click elsewhere or Escape, and goldens for the highlight. Open decision for Charles: selection inside one message only (smaller), or across messages like the web client.
Author
Owner

Spec: select and copy message text, within one message

Decision (Charles, 2026-11-19): selection inside one message is enough for now. Design it so selection across messages can be added later without redoing the model.

Behaviour

  1. Drag to select. Pressing the left button on a message's text and dragging selects from the press point to the pointer, by character. The selection never leaves the message it started in: dragging outside the message clamps to its first or last character.
  2. Double-click selects the word under the pointer; triple-click selects the whole block (paragraph, list item, quote line or code block) under the pointer.
  3. Click without drag keeps today's behaviour: a link, mention or emoji still activates. A press on a link that turns into a drag (more than 4 px) selects and does not open the link.
  4. One selection at a time in the whole window. Starting one in another message, or in the other list (channel vs thread side panel), replaces it.
  5. Copy. Ctrl+C copies the selection when one exists and no text input has the keyboard focus with a selection of its own. The message context menu gets a copy entry for the selection, placed first, shown only when the right-click is on the message that holds the selection; use the original client's label for copying selected text if it has one (check the fork checkout), otherwise "Copy".
  6. Copied text is plain text: what is displayed, with unicode emoji as the character, custom emoji as :name:, mentions as shown (@name, #channel), links as their shown text (the URL when the URL is shown), and one newline between blocks. Code block contents are copied exactly, without the fence.
  7. Clearing. Escape, a click anywhere that does not start a new selection, switching channel or closing the thread panel, and the message being edited or deleted all clear the selection.
  8. Looks. The highlight is drawn behind the glyphs in the theme's selection colour (take the original client's ::selection colour for the dark and light themes). The pointer is the text cursor over selectable text, and stays the hand over links.

Where it applies

Message bodies drawn through message_row in every list that uses it: the channel list, the thread side panel, and any other view built on the same row (say which in the PR). All three text paths must work: InlineFlow, the rich_text paragraphs used for right-to-left text, and code blocks.

Out of scope here (list them in the PR as follow-ups if cheap to note): embeds, system messages, replies' preview line, selection across messages, keyboard selection (Shift+arrows), and touch.

Design constraints

  • The selection lives in UI state, not in fluxer-core: { list (channel or thread panel), message id, anchor, focus } with positions as (block index, character offset in that block's displayed text). A later cross-message version widens anchor and focus with a message id each; do not bake "same message" into the position type.
  • Hit-testing and highlight rectangles come from the same layout the widget already computes; no second layout pass per frame for rows without a selection.
  • Rows without a selection must cost nothing extra to draw.
  • The selected text is user content: never log it and keep it out of Debug output.

Tests

  • Unit tests for hit-testing (start, middle, end of line, wrapped lines, between inline boxes such as emoji and mentions) and for word and block boundaries.
  • Model tests for the copied text of each inline kind in rule 6, for each clearing rule in 7, and that a plain click on a link still opens it while a drag from a link selects.
  • Interaction tests in both the channel list and the thread side panel.
  • Goldens (lavapipe) for: a partial selection across a wrapped line, a selection covering emoji and a mention, a selection in a code block.
## Spec: select and copy message text, within one message Decision (Charles, 2026-11-19): selection inside one message is enough for now. Design it so selection across messages can be added later without redoing the model. ### Behaviour 1. **Drag to select.** Pressing the left button on a message's text and dragging selects from the press point to the pointer, by character. The selection never leaves the message it started in: dragging outside the message clamps to its first or last character. 2. **Double-click** selects the word under the pointer; **triple-click** selects the whole block (paragraph, list item, quote line or code block) under the pointer. 3. **Click without drag** keeps today's behaviour: a link, mention or emoji still activates. A press on a link that turns into a drag (more than 4 px) selects and does not open the link. 4. **One selection at a time** in the whole window. Starting one in another message, or in the other list (channel vs thread side panel), replaces it. 5. **Copy.** Ctrl+C copies the selection when one exists and no text input has the keyboard focus with a selection of its own. The message context menu gets a copy entry for the selection, placed first, shown only when the right-click is on the message that holds the selection; use the original client's label for copying selected text if it has one (check the fork checkout), otherwise "Copy". 6. **Copied text** is plain text: what is displayed, with unicode emoji as the character, custom emoji as `:name:`, mentions as shown (`@name`, `#channel`), links as their shown text (the URL when the URL is shown), and one newline between blocks. Code block contents are copied exactly, without the fence. 7. **Clearing.** Escape, a click anywhere that does not start a new selection, switching channel or closing the thread panel, and the message being edited or deleted all clear the selection. 8. **Looks.** The highlight is drawn behind the glyphs in the theme's selection colour (take the original client's `::selection` colour for the dark and light themes). The pointer is the text cursor over selectable text, and stays the hand over links. ### Where it applies Message bodies drawn through `message_row` in every list that uses it: the channel list, the thread side panel, and any other view built on the same row (say which in the PR). All three text paths must work: `InlineFlow`, the `rich_text` paragraphs used for right-to-left text, and code blocks. Out of scope here (list them in the PR as follow-ups if cheap to note): embeds, system messages, replies' preview line, selection across messages, keyboard selection (Shift+arrows), and touch. ### Design constraints - The selection lives in UI state, not in `fluxer-core`: `{ list (channel or thread panel), message id, anchor, focus }` with positions as (block index, character offset in that block's displayed text). A later cross-message version widens anchor and focus with a message id each; do not bake "same message" into the position type. - Hit-testing and highlight rectangles come from the same layout the widget already computes; no second layout pass per frame for rows without a selection. - Rows without a selection must cost nothing extra to draw. - The selected text is user content: never log it and keep it out of `Debug` output. ### Tests - Unit tests for hit-testing (start, middle, end of line, wrapped lines, between inline boxes such as emoji and mentions) and for word and block boundaries. - Model tests for the copied text of each inline kind in rule 6, for each clearing rule in 7, and that a plain click on a link still opens it while a drag from a link selects. - Interaction tests in both the channel list and the thread side panel. - Goldens (lavapipe) for: a partial selection across a wrapped line, a selection covering emoji and a mention, a selection in a code block.
Author
Owner

Fixed in nightly 2026.1119.406.

Fixed in nightly 2026.1119.406.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#946
No description provided.