pub struct AskState {
pub question: String,
pub context: String,
pub options: Vec<AskOption>,
pub mode: AskMode,
pub cursor: usize,
pub input: String,
pub input_cursor: usize,
pub input_active: bool,
pub placeholder: String,
pub editor_cursor: usize,
}Expand description
State for the ask overlay bar.
Fields§
§question: String§context: String§options: Vec<AskOption>§mode: AskMode§cursor: usize§input: String§input_cursor: usize§input_active: bool§placeholder: String§editor_cursor: usizeImplementations§
Source§impl AskState
impl AskState
pub fn new( question: String, context: String, options: Vec<AskOption>, multi: bool, ) -> Self
pub fn with_placeholder( question: String, context: String, options: Vec<AskOption>, multi: bool, placeholder: String, ) -> Self
pub fn sync_from_editor(&mut self, text: &str, cursor: usize)
pub fn height(&self, width: u16) -> u16
Sourcepub fn prompt_height(&self, width: u16) -> u16
pub fn prompt_height(&self, width: u16) -> u16
Height needed to render this prompt, including its border.
Sourcepub fn cursor_screen_position(&self, area: Rect) -> (u16, u16)
pub fn cursor_screen_position(&self, area: Rect) -> (u16, u16)
Cursor position inside the ask prompt area.
Sourcepub fn cursor_down(&mut self)
pub fn cursor_down(&mut self)
Move cursor down.
Sourcepub fn toggle_current(&mut self)
pub fn toggle_current(&mut self)
Toggle checkbox in multi-select mode.
Sourcepub fn tab_to_edit(&mut self)
pub fn tab_to_edit(&mut self)
Tab: copy highlighted option text into the input editor.
Sourcepub fn quick_select(&mut self, n: usize) -> bool
pub fn quick_select(&mut self, n: usize) -> bool
Toggle or quick-select by number (1-9).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AskState
impl RefUnwindSafe for AskState
impl Send for AskState
impl Sync for AskState
impl Unpin for AskState
impl UnsafeUnpin for AskState
impl UnwindSafe for AskState
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