pub struct TextInput { /* private fields */ }Expand description
Text input buffer with cursor management
Implementations§
Source§impl TextInput
impl TextInput
Sourcepub fn insert_char(&mut self, c: char)
pub fn insert_char(&mut self, c: char)
Insert a character at the cursor position
Sourcepub fn delete_char_before(&mut self)
pub fn delete_char_before(&mut self)
Delete the character before the cursor (backspace)
Sourcepub fn delete_char_at(&mut self)
pub fn delete_char_at(&mut self)
Delete the character at the cursor position (delete key)
Sourcepub fn move_right(&mut self)
pub fn move_right(&mut self)
Move cursor right one character
Sourcepub fn move_to_line_start(&mut self)
pub fn move_to_line_start(&mut self)
Move cursor to the start of the current line
Sourcepub fn move_to_line_end(&mut self)
pub fn move_to_line_end(&mut self)
Move cursor to the end of the current line
Sourcepub fn cursor_line_col(&self) -> (usize, usize)
pub fn cursor_line_col(&self) -> (usize, usize)
Get the current cursor position as (line, column)
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Get the number of logical lines in the buffer
Sourcepub fn visual_line_count(
&self,
width: usize,
prompt_len: usize,
indent_len: usize,
) -> usize
pub fn visual_line_count( &self, width: usize, prompt_len: usize, indent_len: usize, ) -> usize
Calculate visual line count accounting for word wrapping
Trait Implementations§
Source§impl Widget for TextInput
impl Widget for TextInput
Source§fn handle_key(
&mut self,
_key: KeyEvent,
_ctx: &WidgetKeyContext<'_>,
) -> WidgetKeyResult
fn handle_key( &mut self, _key: KeyEvent, _ctx: &WidgetKeyContext<'_>, ) -> WidgetKeyResult
Handle key event, return result indicating what action to take. Read more
Source§fn required_height(&self, _available: u16) -> u16
fn required_height(&self, _available: u16) -> u16
Calculate required height for this widget Read more
Source§fn blocks_input(&self) -> bool
fn blocks_input(&self) -> bool
Whether this widget blocks input to the text input when active
Source§fn is_overlay(&self) -> bool
fn is_overlay(&self) -> bool
Whether this widget is a full-screen overlay Read more
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Cast to Any for mutable downcasting
Auto Trait Implementations§
impl Freeze for TextInput
impl RefUnwindSafe for TextInput
impl Send for TextInput
impl Sync for TextInput
impl Unpin for TextInput
impl UnwindSafe for TextInput
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