pub struct RecallState {Show 19 fields
engine: SearchEngine,
filter_mode: FilterMode,
host_filter: HostFilter,
entries: Vec<HistoryEntry>,
filtered_indices: Vec<(usize, Vec<u32>)>,
query: String,
selected_index: usize,
scroll_offset: usize,
term_height: u16,
term_width: u16,
keymap_mode: KeymapMode,
show_preview: bool,
preview_config: PreviewConfig,
shell_mode: bool,
db_query_used: Option<RecallQuery>,
entry_cache: EntryCache,
flash_until: Option<Instant>,
status_message: Option<(String, Instant)>,
needs_redraw: bool,
}Expand description
The pure recall UI state machine: entries, cache, query, selection,
scroll, keymaps, and frame rendering – everything except the terminal
itself. Constructible without a tty, so key handling, scroll math, cache
coverage, and drawing (into any Write) are all unit-testable.
Fields§
§engine: SearchEngine§filter_mode: FilterMode§host_filter: HostFilter§entries: Vec<HistoryEntry>§filtered_indices: Vec<(usize, Vec<u32>)>Filtered indices with match positions: (entry_index, match_char_indices)
query: String§selected_index: usize§scroll_offset: usize§term_height: u16§term_width: u16§keymap_mode: KeymapMode§show_preview: bool§preview_config: PreviewConfig§shell_mode: bool§db_query_used: Option<RecallQuery>§entry_cache: EntryCache§flash_until: Option<Instant>§status_message: Option<(String, Instant)>§needs_redraw: boolImplementations§
Source§impl RecallState
impl RecallState
fn new( engine: SearchEngine, initial_mode: FilterMode, initial_query: Option<String>, config: &RecallConfig, shell_mode: bool, ) -> Result<Self>
fn set_dimensions(&mut self, width: u16, height: u16)
Sourcefn expire_timed_effects(&mut self) -> bool
fn expire_timed_effects(&mut self) -> bool
Clear expired timed effects (status message, flash); returns true if anything changed and a redraw is needed.
fn results_height(&self) -> usize
fn adjust_scroll_for_selection(&mut self)
Sourcefn reload_entries(&mut self)
fn reload_entries(&mut self)
Reload entries from database and re-apply fuzzy filtering. Called when mode (directory/global) or host filter changes, which invalidates previously cached candidate sets. (Deletion keeps the live set and clears the cache in place instead.) Always loads the broad set (no query filter at DB level).
Sourcefn update_filtered_indices(&mut self)
fn update_filtered_indices(&mut self)
Apply fuzzy filtering to the current entries based on query. The query is parsed once here; the same parse drives both the candidate coverage check and the fuzzy stage, so the two cannot disagree about atom semantics.
Sourcefn ensure_entries_cover_query(&mut self, query: &RecallQuery)
fn ensure_entries_cover_query(&mut self, query: &RecallQuery)
Ensure self.entries is a valid candidate superset for the current
query, hitting the database only when no previously loaded set covers
it. Queries >= 3 chars with at least one prefilterable atom want a
DB-level LIKE dig so old commands beyond the initial result_limit
window are included; shorter queries (and ones with no prefilterable
atoms, e.g. pure negation “!vim”) want the broad recency window.
Appending to a query is covered by the current set (LIKE ‘%abc%’ is a
superset of LIKE ‘%abcd%’); backspacing restores the previous set from
the cache. Only divergent edits reach the database.
Sourcefn take_current_snapshot(&mut self) -> EntrySnapshot
fn take_current_snapshot(&mut self) -> EntrySnapshot
Move the current candidate set out of self for caching.
Sourcefn is_flashing(&self) -> bool
fn is_flashing(&self) -> bool
Check if flash effect is currently active
Sourcefn copy_selected(&mut self) -> KeyAction
fn copy_selected(&mut self) -> KeyAction
Stage the selected command for a clipboard copy. The terminal adapter performs the actual OSC 52 write; state only records the feedback.
Sourcefn delete_selected_entry(&mut self)
fn delete_selected_entry(&mut self)
Delete all database rows matching the selected entry’s command text, since the recall list is deduplicated by command.
fn toggle_host_filter(&mut self)
fn toggle_filter_mode(&mut self)
fn print_entry_details(&self)
fn get_selected_command(&self) -> Option<String>
fn handle_key(&mut self, key: KeyEvent) -> Result<KeyAction>
Sourcefn handle_common_key(&mut self, key: KeyEvent) -> Option<KeyAction>
fn handle_common_key(&mut self, key: KeyEvent) -> Option<KeyAction>
Handle common keys that work in all modes
fn handle_key_emacs(&mut self, key: KeyEvent) -> Result<KeyAction>
fn handle_key_vim_insert(&mut self, key: KeyEvent) -> Result<KeyAction>
fn handle_key_vim_normal(&mut self, key: KeyEvent) -> Result<KeyAction>
fn move_selection_up(&mut self)
fn move_selection_down(&mut self)
fn page_up(&mut self)
fn page_down(&mut self)
fn insert_char(&mut self, c: char)
fn delete_last_char(&mut self)
fn clear_query(&mut self)
fn delete_last_word(&mut self)
fn draw_preview<W: Write>( &self, w: &mut W, start_y: u16, width: u16, ) -> Result<()>
Auto Trait Implementations§
impl !Freeze for RecallState
impl !RefUnwindSafe for RecallState
impl !Sync for RecallState
impl !UnwindSafe for RecallState
impl Send for RecallState
impl Unpin for RecallState
impl UnsafeUnpin for RecallState
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
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 more