MicroscopeState

Struct MicroscopeState 

Source
pub struct MicroscopeState {
Show 19 fields pub active: bool, pub query: String, pub cursor_pos: usize, pub all_items: Vec<MicroscopeItem>, pub items: Vec<MicroscopeItem>, pub selected_index: usize, pub scroll_offset: usize, pub picker_name: String, pub title: String, pub prompt: String, pub preview: Option<PreviewContent>, pub layout: MicroscopeLayout, pub preview_enabled: bool, pub prompt_mode: PromptMode, pub loading_state: LoadingState, pub bounds: LayoutBounds, pub layout_config: LayoutConfig, pub total_count: u32, pub matched_count: u32,
}
Expand description

State of the microscope fuzzy finder

Fields§

§active: bool

Whether microscope is currently active/visible

§query: String

Current search query

§cursor_pos: usize

Cursor position in the query

§all_items: Vec<MicroscopeItem>

All items from the picker (unfiltered)

§items: Vec<MicroscopeItem>

Current list of items (filtered/sorted)

§selected_index: usize

Currently selected item index

§scroll_offset: usize

Scroll offset for long lists

§picker_name: String

Name of the current picker

§title: String

Title to display

§prompt: String

Prompt string

§preview: Option<PreviewContent>

Preview content (if available)

§layout: MicroscopeLayout

Legacy layout configuration (for compatibility)

§preview_enabled: bool

Whether preview is enabled

§prompt_mode: PromptMode

Prompt mode (Insert/Normal)

§loading_state: LoadingState

Loading state

§bounds: LayoutBounds

Helix-style layout bounds

§layout_config: LayoutConfig

Layout configuration

§total_count: u32

Total item count (from matcher)

§matched_count: u32

Matched item count (from matcher)

Implementations§

Source§

impl MicroscopeState

Source

pub fn new() -> Self

Create a new empty microscope state

Source

pub fn open(&mut self, picker_name: &str, title: &str, prompt: &str)

Open microscope with a picker

Starts in Normal mode for j/k navigation. Press ‘i’ to enter Insert mode.

Source

pub fn close(&mut self)

Close microscope

Source

pub fn enter_insert(&mut self)

Enter insert mode

Source

pub fn enter_normal(&mut self)

Enter normal mode

Source

pub fn toggle_mode(&mut self)

Toggle between insert and normal mode

Source

pub fn set_loading(&mut self, state: LoadingState)

Set loading state

Source

pub fn update_bounds(&mut self, screen_width: u16, screen_height: u16)

Update bounds from screen dimensions

Source

pub fn status_text(&self) -> String

Get status line text

Source

pub fn update_items(&mut self, items: Vec<MicroscopeItem>)

Update items from search results (initial load - stores in both all_items and items)

Source

pub fn update_filtered_items(&mut self, items: Vec<MicroscopeItem>)

Update filtered items only (for filtering - keeps all_items unchanged)

Source

pub fn insert_char(&mut self, c: char)

Insert a character at cursor position

Source

pub fn delete_char(&mut self)

Delete character before cursor

Source

pub fn cursor_left(&mut self)

Move cursor left

Source

pub fn cursor_right(&mut self)

Move cursor right

Source

pub const fn cursor_home(&mut self)

Move cursor to start

Source

pub fn cursor_end(&mut self)

Move cursor to end

Source

pub fn word_forward(&mut self)

Move cursor forward one word

Source

pub fn word_backward(&mut self)

Move cursor backward one word

Source

pub fn clear_query(&mut self)

Clear the query

Source

pub fn delete_word(&mut self)

Delete word before cursor

Source

pub fn select_next(&mut self)

Select next item

Source

pub fn select_prev(&mut self)

Select previous item

Source

pub fn page_down(&mut self)

Page down

Source

pub fn page_up(&mut self)

Page up

Source

pub fn move_to_first(&mut self)

Move to first item

Source

pub fn move_to_last(&mut self)

Move to last item

Source

pub fn selected_item(&self) -> Option<&MicroscopeItem>

Get currently selected item

Source

pub const fn is_visible(&self) -> bool

Check if microscope is active and visible

Source

pub fn visible_items(&self) -> &[MicroscopeItem]

Get visible items slice

Source

pub fn set_preview(&mut self, content: Option<PreviewContent>)

Update preview content

Source

pub fn calculate_layout(&mut self, screen_width: u16, screen_height: u16)

Calculate layout based on screen dimensions

Trait Implementations§

Source§

impl Clone for MicroscopeState

Source§

fn clone(&self) -> MicroscopeState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MicroscopeState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MicroscopeState

Source§

fn default() -> MicroscopeState

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more