pub struct InputState {
pub lines: Vec<String>,
pub cursor_row: usize,
pub cursor_col: usize,
pub version: u64,
pub paste_blocks: Vec<String>,
/* private fields */
}Fields§
§lines: Vec<String>§cursor_row: usize§cursor_col: usize§version: u64Monotonically increasing version counter. Bumped on every content or cursor change so that downstream caches (e.g. wrap result) can detect staleness cheaply.
paste_blocks: Vec<String>Stored paste blocks: each entry holds the full text of a large paste (>10 lines).
A placeholder line [Pasted Text N] is inserted into lines at the paste point.
On text(), placeholders are expanded back to the original pasted content.
Implementations§
Source§impl InputState
impl InputState
pub fn new() -> Self
pub fn text(&self) -> String
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Sourcepub fn set_text(&mut self, text: &str)
pub fn set_text(&mut self, text: &str)
Replace the input with the given text, placing the cursor at the end.
pub fn insert_char(&mut self, c: char)
pub fn sync_textarea_engine(&mut self)
pub fn textarea_insert_char(&mut self, c: char) -> bool
pub fn textarea_insert_newline(&mut self) -> bool
pub fn textarea_delete_char_before(&mut self) -> bool
pub fn textarea_delete_char_after(&mut self) -> bool
pub fn textarea_move_left(&mut self) -> bool
pub fn textarea_move_right(&mut self) -> bool
pub fn textarea_move_up(&mut self) -> bool
pub fn textarea_move_down(&mut self) -> bool
pub fn textarea_move_home(&mut self) -> bool
pub fn textarea_move_end(&mut self) -> bool
pub fn textarea_undo(&mut self) -> bool
pub fn textarea_redo(&mut self) -> bool
pub fn textarea_move_word_left(&mut self) -> bool
pub fn textarea_move_word_right(&mut self) -> bool
pub fn textarea_delete_word_before(&mut self) -> bool
pub fn textarea_delete_word_after(&mut self) -> bool
pub fn insert_newline(&mut self)
pub fn insert_str(&mut self, s: &str)
Sourcepub fn insert_paste_block(&mut self, text: &str) -> String
pub fn insert_paste_block(&mut self, text: &str) -> String
Insert a large paste as a compact placeholder line.
The full text is stored in paste_blocks and expanded by text() on submit.
Returns the placeholder label for display purposes.
Sourcepub fn append_to_active_paste_block(&mut self, text: &str) -> bool
pub fn append_to_active_paste_block(&mut self, text: &str) -> bool
Append text to the paste block under the cursor if the cursor currently sits at the end of a standalone placeholder line.
This handles terminals that deliver one clipboard paste as multiple
Event::Paste chunks.
pub fn delete_char_before(&mut self)
pub fn delete_char_after(&mut self)
pub fn move_left(&mut self)
pub fn move_right(&mut self)
pub fn move_up(&mut self)
pub fn move_down(&mut self)
pub fn move_home(&mut self)
pub fn move_end(&mut self)
pub fn line_count(&self) -> u16
Trait Implementations§
Source§impl Debug for InputState
impl Debug for InputState
Auto Trait Implementations§
impl !Freeze for InputState
impl RefUnwindSafe for InputState
impl Send for InputState
impl Sync for InputState
impl Unpin for InputState
impl UnsafeUnpin 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
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 more