use crate::ui::cursor::CursorState;
#[derive(Debug, Clone)]
pub struct InputState {
pub current_input: String,
pub cursor_pos: usize,
pub is_modifying: bool,
}
impl Default for InputState {
fn default() -> Self {
Self::new()
}
}
impl InputState {
pub fn new() -> Self {
Self {
current_input: String::new(),
cursor_pos: 0,
is_modifying: false,
}
}
}
impl CursorState for InputState {
fn get_text(&self) -> &str {
&self.current_input
}
fn get_text_mut(&mut self) -> &mut String {
&mut self.current_input
}
fn get_cursor_pos(&self) -> usize {
self.cursor_pos
}
fn set_cursor_pos(&mut self, pos: usize) {
self.cursor_pos = pos;
}
}