InputManager

Trait InputManager 

Source
pub trait InputManager: Send + Sync {
Show 17 methods // Required methods fn get_text(&self) -> String; fn set_text(&mut self, text: String); fn get_cursor_position(&self) -> usize; fn set_cursor_position(&mut self, position: usize); fn handle_key_event(&mut self, event: KeyEvent) -> bool; fn clear(&mut self); fn is_empty(&self) -> bool; fn get_visual_cursor(&self) -> (u16, u16); fn is_multiline(&self) -> bool; fn line_count(&self) -> usize; fn get_line(&self, index: usize) -> Option<String>; fn clone_box(&self) -> Box<dyn InputManager>; fn set_history(&mut self, history: Vec<String>); fn history_previous(&mut self) -> bool; fn history_next(&mut self) -> bool; fn get_history_index(&self) -> Option<usize>; fn reset_history_position(&mut self);
}
Expand description

Unified interface for managing input widgets (Input and TextArea) This trait abstracts the differences between single-line and multi-line input allowing the Buffer system to work with either transparently

Required Methods§

Source

fn get_text(&self) -> String

Get the current text content

Source

fn set_text(&mut self, text: String)

Set the text content

Source

fn get_cursor_position(&self) -> usize

Get the current cursor position (char offset from start)

Source

fn set_cursor_position(&mut self, position: usize)

Set the cursor position (char offset from start)

Source

fn handle_key_event(&mut self, event: KeyEvent) -> bool

Handle a key event

Source

fn clear(&mut self)

Clear the content

Source

fn is_empty(&self) -> bool

Check if content is empty

Source

fn get_visual_cursor(&self) -> (u16, u16)

Get the visual cursor position for rendering (row, col)

Source

fn is_multiline(&self) -> bool

Check if this is a multi-line input

Source

fn line_count(&self) -> usize

Get line count (1 for single-line)

Source

fn get_line(&self, index: usize) -> Option<String>

Get a specific line of text (0-indexed)

Source

fn clone_box(&self) -> Box<dyn InputManager>

Clone the input manager (for undo/redo)

Source

fn set_history(&mut self, history: Vec<String>)

Set the history entries for navigation

Source

fn history_previous(&mut self) -> bool

Navigate to previous history entry (returns true if navigation occurred)

Source

fn history_next(&mut self) -> bool

Navigate to next history entry (returns true if navigation occurred)

Source

fn get_history_index(&self) -> Option<usize>

Get current history index (None if not navigating history)

Source

fn reset_history_position(&mut self)

Reset history navigation (go back to user input)

Implementors§