retroglyph_ui/widget/highlight_spacing.rs
1//! [`HighlightSpacing`]: whether [`List`](super::List)'s marker column reserves width when
2//! nothing is selected.
3
4/// Whether [`List`](super::List)'s [`highlight_symbol`](super::List::highlight_symbol) marker
5/// column reserves width even when [`ListState::selected`](crate::ListState::selected) is
6/// `None`.
7///
8/// [`HighlightSpacing::WhenSelected`] is the default: with nothing selected, the list renders no
9/// marker column at all, and one only appears (shifting every item's text right by the
10/// symbol's width) the moment something becomes selected. [`HighlightSpacing::Always`] reserves
11/// the column unconditionally, so item text never shifts as selection comes and goes.
12/// [`HighlightSpacing::Never`] never reserves it, so the symbol never renders even while
13/// something is selected.
14#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
15pub enum HighlightSpacing {
16 /// Always reserve the marker column's width, whether or not anything is selected.
17 Always,
18 /// Reserve the marker column's width only while
19 /// [`ListState::selected`](crate::ListState::selected) is `Some`.
20 #[default]
21 WhenSelected,
22 /// Never reserve the marker column's width; the highlight symbol never renders.
23 Never,
24}