diff --git a/crates/libtiny_tui/src/input_area/mod.rs b/crates/libtiny_tui/src/input_area/mod.rs index 8d92f4f8..a044c77f 100644 --- a/crates/libtiny_tui/src/input_area/mod.rs +++ b/crates/libtiny_tui/src/input_area/mod.rs @@ -260,6 +260,14 @@ impl InputArea { self.move_cursor_to_end(); WidgetRet::KeyHandled } + KeyAction::InputDeleteToStart => { + if self.cursor != 0 { + self.modify(); + self.buffer.drain(..self.cursor as usize); + self.move_cursor(0); + } + WidgetRet::KeyHandled + } KeyAction::InputDeleteToEnd => { if self.cursor != self.current_buffer_len() { self.modify(); diff --git a/crates/libtiny_tui/src/key_map.rs b/crates/libtiny_tui/src/key_map.rs index e4c931a4..9b571163 100644 --- a/crates/libtiny_tui/src/key_map.rs +++ b/crates/libtiny_tui/src/key_map.rs @@ -37,6 +37,7 @@ pub(crate) enum KeyAction { InputSend, InputDeletePrevChar, InputDeleteNextChar, + InputDeleteToStart, InputDeleteToEnd, InputDeletePrevWord, InputMoveCursEnd, @@ -72,6 +73,7 @@ impl Display for KeyAction { KeyAction::InputSend => "input_send", KeyAction::InputDeletePrevChar => "input_delete_prev_char", KeyAction::InputDeleteNextChar => "input_delete_next_char", + KeyAction::InputDeleteToStart => "input_delete_to_start", KeyAction::InputDeleteToEnd => "input_delete_to_end", KeyAction::InputDeletePrevWord => "input_delete_prev_word", KeyAction::InputMoveCursEnd => "input_move_curs_end",