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§
Sourcefn get_cursor_position(&self) -> usize
fn get_cursor_position(&self) -> usize
Get the current cursor position (char offset from start)
Sourcefn set_cursor_position(&mut self, position: usize)
fn set_cursor_position(&mut self, position: usize)
Set the cursor position (char offset from start)
Sourcefn handle_key_event(&mut self, event: KeyEvent) -> bool
fn handle_key_event(&mut self, event: KeyEvent) -> bool
Handle a key event
Sourcefn get_visual_cursor(&self) -> (u16, u16)
fn get_visual_cursor(&self) -> (u16, u16)
Get the visual cursor position for rendering (row, col)
Sourcefn is_multiline(&self) -> bool
fn is_multiline(&self) -> bool
Check if this is a multi-line input
Sourcefn line_count(&self) -> usize
fn line_count(&self) -> usize
Get line count (1 for single-line)
Sourcefn clone_box(&self) -> Box<dyn InputManager>
fn clone_box(&self) -> Box<dyn InputManager>
Clone the input manager (for undo/redo)
Sourcefn set_history(&mut self, history: Vec<String>)
fn set_history(&mut self, history: Vec<String>)
Set the history entries for navigation
Sourcefn history_previous(&mut self) -> bool
fn history_previous(&mut self) -> bool
Navigate to previous history entry (returns true if navigation occurred)
Sourcefn history_next(&mut self) -> bool
fn history_next(&mut self) -> bool
Navigate to next history entry (returns true if navigation occurred)
Sourcefn get_history_index(&self) -> Option<usize>
fn get_history_index(&self) -> Option<usize>
Get current history index (None if not navigating history)
Sourcefn reset_history_position(&mut self)
fn reset_history_position(&mut self)
Reset history navigation (go back to user input)