pub struct InputEditor { /* private fields */ }Expand description
Input text editor with cursor management
Implementations§
Source§impl InputEditor
impl InputEditor
Sourcepub fn set_cursor(&mut self, pos: usize)
pub fn set_cursor(&mut self, pos: usize)
Set cursor position (clamped to valid range)
Sourcepub fn is_cursor_at_start(&self) -> bool
pub fn is_cursor_at_start(&self) -> bool
Check if cursor is at start
Sourcepub fn is_cursor_at_end(&self) -> bool
pub fn is_cursor_at_end(&self) -> bool
Check if cursor is at end
Sourcepub fn insert_char(&mut self, c: char)
pub fn insert_char(&mut self, c: char)
Insert a character at cursor position
Sourcepub fn insert_str(&mut self, s: &str)
pub fn insert_str(&mut self, s: &str)
Insert a string at cursor position
Sourcepub fn insert_paste(&mut self, text: &str) -> bool
pub fn insert_paste(&mut self, text: &str) -> bool
Insert paste with size limit Returns true if truncated
Sourcepub fn delete_char_before(&mut self) -> bool
pub fn delete_char_before(&mut self) -> bool
Delete character before cursor (backspace)
Sourcepub fn delete_char_at(&mut self) -> bool
pub fn delete_char_at(&mut self) -> bool
Delete character at cursor (delete key)
Sourcepub fn move_right(&mut self)
pub fn move_right(&mut self)
Move cursor right one character
Sourcepub fn move_to_start(&mut self)
pub fn move_to_start(&mut self)
Move cursor to start
Sourcepub fn move_to_end(&mut self)
pub fn move_to_end(&mut self)
Move cursor to end
Sourcepub fn take_trimmed(&mut self) -> String
pub fn take_trimmed(&mut self) -> String
Get trimmed text and clear
Sourcepub fn replace_range(&mut self, start: usize, end: usize, replacement: &str)
pub fn replace_range(&mut self, start: usize, end: usize, replacement: &str)
Replace text in a range (used for autocomplete)
Sourcepub fn delete_range_to_cursor(&mut self, start: usize)
pub fn delete_range_to_cursor(&mut self, start: usize)
Delete from start to cursor
Sourcepub fn text_before_cursor(&self) -> &str
pub fn text_before_cursor(&self) -> &str
Get text before cursor
Sourcepub fn text_after_cursor(&self) -> &str
pub fn text_after_cursor(&self) -> &str
Get text after cursor
Sourcepub fn char_at_cursor(&self) -> Option<char>
pub fn char_at_cursor(&self) -> Option<char>
Get character at cursor (if any)
Sourcepub fn char_before_cursor(&self) -> Option<char>
pub fn char_before_cursor(&self) -> Option<char>
Get character before cursor (if any)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InputEditor
impl RefUnwindSafe for InputEditor
impl Send for InputEditor
impl Sync for InputEditor
impl Unpin for InputEditor
impl UnsafeUnpin for InputEditor
impl UnwindSafe for InputEditor
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> 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