Skip to main content

Module multiselect

Module multiselect 

Source
Expand description

A batteries-included, multi-region text panel: MultiSelectPanel.

Where crate::panel::SelectablePanel covers the common single-selection, mouse-only case, MultiSelectPanel bundles the same primitives into a panel that additionally supports:

  • Multiple simultaneous selection regions — one active (live, draggable, keyboard-extendable) region plus any number of finalized ones, so an app can build up several highlighted runs (e.g. with an Alt-click gesture) and copy them together.
  • Keyboard extension — grow the active region a character or a line at a time (extend), scrolling it into view.
  • Owned scrolling with drag auto-scroll — the panel owns its scroll offset, so a drag held past the top/bottom edge keeps scrolling and extending the selection (autoscroll_tick).
  • Styled content — set syntax-highlighted Lines directly (set_styled_content), not just plain (or ANSI) text.

Cross-panel concerns (ordering a copy that spans two different panels, excluding app-specific annotation glyphs from copied text, drawing a scrollbar) stay with the host: the panel exposes selected_parts and highlight_regions so the host can compose several panels however it likes.

Structs§

MultiSelectPanel
One scrollable text panel that owns its scroll offset and one-or-more selection regions.

Enums§

AutoScroll
A vertical auto-scroll direction for MultiSelectPanel::start_autoscroll, used when a selection drag is held past the panel’s top or bottom edge.
Motion
A keyboard motion for MultiSelectPanel::extend — which way to move the active region’s live end.