pub struct SearchList<R: SearchRow> { /* private fields */ }Implementations§
Source§impl<R: SearchRow> SearchList<R>
impl<R: SearchRow> SearchList<R>
pub fn builder( source: impl RowSource<R>, redraw: Arc<dyn Fn() + Send + Sync>, ) -> SearchListBuilder<R>
pub fn poll(&mut self)
Sourcepub fn visible_len(&self) -> usize
pub fn visible_len(&self) -> usize
Length of the visible sequence [leading?] ++ display.
Sourcepub fn match_count(&self) -> usize
pub fn match_count(&self) -> usize
Number of real matches — the visible rows minus the synthetic leading affordance (“Create: …”), for result-count displays.
Sourcepub fn rows(&self) -> &[R]
pub fn rows(&self) -> &[R]
The source-delivered rows only (NOT the leading row). Prefer
visible_len/visible_rows
for visible counts.
pub fn selected_row(&self) -> Option<&R>
pub fn visible_rows(&self) -> Vec<&R>
pub fn query(&self) -> &str
Sourcepub fn take_accepted_saved_search(&mut self) -> Option<String>
pub fn take_accepted_saved_search(&mut self) -> Option<String>
Take the name of a just-accepted saved search, if any. The host calls
this after a Consumed key to learn whether to pin (or refresh) the
saved-search breadcrumb. Returns None once read.
pub fn is_loading(&self) -> bool
Sourcepub fn set_query(&mut self, q: impl Into<String>)
pub fn set_query(&mut self, q: impl Into<String>)
Set the query programmatically: updates the visible input widget (cursor
to end) AND the query string, then starts a load (for reload_on_query
sources) or recomputes the display. This is the setter every external
caller wants — a saved search applied, a sort directive rewritten — so
the input bar always reflects the query. The interactive keystroke path
uses sync_query_from_input instead,
because the input widget already holds the typed text (and its cursor
must not jump back to the end on every keystroke).
Sourcepub fn update_rows(&mut self, mutate: impl FnMut(&mut R) -> bool) -> bool
pub fn update_rows(&mut self, mutate: impl FnMut(&mut R) -> bool) -> bool
Mutate rows in place. mutate is called for each row and returns true
for each row it changed; if any did, the display order is recomputed
(re-filter, no re-sort) so an active filter stays correct. Returns
whether anything changed.
This is the one seam that touches rows outside the RowSource; every
other change rebuilds from the source. Structural changes (add/remove/
reorder) must still reload. See adr/0010.
pub fn select_next(&mut self)
pub fn select_prev(&mut self)
Sourcepub fn scroll_down(&mut self)
pub fn scroll_down(&mut self)
Scroll the viewport one row down, carrying the selection along so the selected row keeps its on-screen position. No-op once the last row is in view — the shared mouse-wheel behavior for every list surface.
Sourcepub fn scroll_up(&mut self)
pub fn scroll_up(&mut self)
Scroll the viewport one row up, carrying the selection along so the selected row keeps its on-screen position. No-op at the top.
pub fn handle_key(&mut self, key: &KeyEvent) -> KeyReaction
pub fn render_query( &mut self, f: &mut Frame<'_>, area: Rect, theme: &Theme, focused: bool, )
pub fn render( &mut self, f: &mut Frame<'_>, area: Rect, theme: &Theme, focused: bool, )
Sourcepub fn set_list_rect(&mut self, rect: Rect)
pub fn set_list_rect(&mut self, rect: Rect)
Override the rect used for mouse hit-testing. The recorded rect must be
the area where list ITEMS actually render — row 0 is the first item, NOT
a block border. Hosts that draw the list inside a bordered block pass the
block’s INNER rect; borderless hosts pass the list area directly. The
recorded rect and the rendered-items rect MUST be identical, so
handle_mouse maps a click at row to visual offset row - rect.y.
Sourcepub fn set_panel_rect(&mut self, rect: Rect)
pub fn set_panel_rect(&mut self, rect: Rect)
Record the host panel’s full bounds so the wheel scrolls the list from
anywhere within the panel — header, query box, preview — not just over
the list items. Hosts call this each render with the same rect they
were drawn into. Never set = wheel hit-tests list_rect only.
Sourcepub fn set_content_rect(&mut self, rect: Rect)
pub fn set_content_rect(&mut self, rect: Rect)
Record a host-owned scrollable sub-region (e.g. an expanded preview):
wheel events inside it are routed back to the host as
SearchMouse::ContentScrollUp/ContentScrollDown instead of
scrolling the list. Hosts re-record it every render (empty when the
sub-region is not drawn) so the hit-test never sees a stale rect.
pub fn render_autocomplete( &mut self, f: &mut Frame<'_>, clamp: Rect, theme: &Theme, )
Sourcepub fn close_autocomplete(&mut self)
pub fn close_autocomplete(&mut self)
Close an open autocomplete popup. handle_mouse does this for every
event it sees (“any mouse interaction dismisses the popup”); hosts that
consume a mouse event WITHOUT routing it through the engine call this
to keep that rule intact.
pub fn handle_mouse(&mut self, m: &MouseEvent) -> SearchMouse
Auto Trait Implementations§
impl<R> !RefUnwindSafe for SearchList<R>
impl<R> !Sync for SearchList<R>
impl<R> !UnwindSafe for SearchList<R>
impl<R> Freeze for SearchList<R>where
R: Freeze,
impl<R> Send for SearchList<R>
impl<R> Unpin for SearchList<R>where
R: Unpin,
impl<R> UnsafeUnpin for SearchList<R>where
R: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more