iced_selection

Crates.ioiced_selection
lib.rsiced_selection
version0.4.0
created_at2025-10-15 21:25:22.436151+00
updated_at2025-12-30 17:56:06.664355+00
descriptionText selection for `iced`
homepagehttps://sr.ht/~pml68/iced_selection
repositoryhttps://git.sr.ht/~pml68/iced_selection
max_upload_size
id1884976
size131,245
Polesznyák Márk László (pml68)

documentation

README

iced_selection

builds.sr.ht status   docs

Text selection API for iced, with reference widget implementations.

Text in iced currently isn't selectable except for TextEditor and TextInput. This is my solution, but others exist as well (see Special thanks).

Check out the examples, or read the documentation to get an idea about the crate.

Roughly:

  • selection.rs: The main selection API, built around iced's Paragraph.
  • text.rs: Reference implementation for a selectable text widget.
    • text/rich.rs: Reference implementation for a selectable rich text widget.
  • markdown.rs: A custom Viewer and its corresponding custom methods.
  • lib.rs: Helper methods, macros and re-exports.

Wrapped text support

Wrapped text is supported, but by-line selection (Shift + Up Arrow / Shift + Down Arrow & triple-click mouse selection) will treat all wrapped segments as part of the same line.

Installation

Simply add it to under your Cargo.toml's dependencies section.

# ...

[dependencies]
iced = { git = "https://github.com/iced-rs/iced", branch = "master" }
iced_selection = { git = "https://git.sr.ht/~pml68/iced_selection" }

Features

  • default:
  • markdown: Provides support for rendering markdown through a custom viewer.

TODO

  • allow out-of-bounds selection dragging
  • custom markdown Viewer
  • double-click + drag for by-word selection
  • triple-click + drag for by-line selection
  • support wrapped lines
  • fix by-line selection for wrapped line segments
  • make "combining" multiple text widgets possible (feat/global-selectable)

Special thanks

  • iced, for making this possible in the first place, and for the modified source code of Text, Rich and Selection (based on text_input/cursor.rs).
  • Halloy, for its amazing selectable text implementation (check it out, but mind the GPLv3!).
  • alex-ds13 for their incredible contributions to iced_selection.
Commit count: 0

cargo fmt