Skip to content

Selection: a window-wide switch for text selection #358

Done

Description

@square3ang

An app setting like "Enable text selection" turns off selection for message bodies everywhere. Selection is per text element, so the switch has to be threaded through every place that builds such text.

Wanted: a subtree or window flag (El::selectable(false) inherited by descendants, with a per-element opt back in for values meant to be copied).

Context: found while porting a chat client's desktop UI to Rune (pinned at 565de6b).

Activity

  1. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    Thanks for the clear write-up. Right now El::selectable only applies to the text element it's called on. El::selection_group and El::caret_browsing change how selectable texts inside a container behave, but they can't turn selection off for a subtree. El::unselectable does apply to a subtree, but only in a web page's DOM mirror; on desktop it changes nothing. So today an app-wide "Enable text selection" setting has to be passed to every place that builds text, as you found.

    I'm treating this as a feature request: a flag that a subtree or window passes down to its descendants and that turns selection off for them, plus a way for a single element to opt back in for values people should still be able to copy.

  2. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    I've opened a pull request that adds El::selection_enabled(bool):

    col()
        .selection_enabled(settings.text_selection)
        .child(text(&message.body).selectable(true))
        .child(text(&message.id).selectable(true).selection_enabled(true))
    • false on your root turns off every .selectable(true) text below it: no drag, double-click, Cmd/Ctrl+A, Tx::select_* or I-beam. This includes memo subtrees, mixed-direction dir_by_paragraph text and virtual_rows that aren't mounted yet, and a selection that's already held clears.
    • true on a descendant keeps a value like an ID copyable.

    It's a separate builder rather than an inherited El::selectable(false). That way your message bodies can keep calling .selectable(true) and the app setting still overrides them. It's documented under "Selectable text" in crates/rune/README.md, and it still needs CI to build it, run the tests and pass review before it can land.

    Fixed in #2206.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions