pub struct InputState { /* private fields */ }Expand description
Text input state machine
Implementations§
Source§impl InputState
impl InputState
pub fn new(default: Option<&str>) -> Self
Sourcepub fn with_completions(default: Option<&str>, items: Vec<String>) -> Self
pub fn with_completions(default: Option<&str>, items: Vec<String>) -> Self
Create input state with completions enabled
pub fn text(&self) -> &str
pub fn cursor(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn has_visible_completions(&self) -> bool
pub fn has_visible_completions(&self) -> bool
Whether completions are enabled and visible with items to show
Sourcepub fn filtered_completions(&self) -> &[CompletionItem]
pub fn filtered_completions(&self) -> &[CompletionItem]
Get the filtered completion items (visible window with scroll offset)
Sourcepub fn selected_index(&self) -> Option<usize>
pub fn selected_index(&self) -> Option<usize>
Get the currently selected completion index (absolute)
Sourcepub fn visible_selection_index(&self) -> Option<usize>
pub fn visible_selection_index(&self) -> Option<usize>
Get the selected index relative to the visible window (for rendering)
Sourcepub fn completion_anchor(&self) -> usize
pub fn completion_anchor(&self) -> usize
Get the character position where completions should be anchored For query params, this is at the ?; for normal completions, it’s 0
Sourcepub fn handle(&mut self, action: InputAction) -> Option<InputResult>
pub fn handle(&mut self, action: InputAction) -> Option<InputResult>
Handle an input action, returns Some if the interaction is complete
Trait Implementations§
Source§impl Clone for InputState
impl Clone for InputState
Source§fn clone(&self) -> InputState
fn clone(&self) -> InputState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InputState
impl RefUnwindSafe for InputState
impl Send for InputState
impl Sync for InputState
impl Unpin for InputState
impl UnwindSafe for InputState
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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