diff --git a/crates/television/action.rs b/crates/television/action.rs index 10cb1c2..11e78f1 100644 --- a/crates/television/action.rs +++ b/crates/television/action.rs @@ -10,6 +10,9 @@ pub enum Action { /// Delete the character before the cursor from the input buffer. #[serde(skip)] DeletePrevChar, + /// Delete the previous word from the input buffer. + #[serde(skip)] + DeletePrevWord, /// Delete the character after the cursor from the input buffer. #[serde(skip)] DeleteNextChar, diff --git a/crates/television/app.rs b/crates/television/app.rs index d2b5ec1..a292719 100644 --- a/crates/television/app.rs +++ b/crates/television/app.rs @@ -195,6 +195,7 @@ impl App { // text input events match keycode { Key::Backspace => return Action::DeletePrevChar, + Key::Ctrl('w') => return Action::DeletePrevWord, Key::Delete => return Action::DeleteNextChar, Key::Left => return Action::GoToPrevChar, Key::Right => return Action::GoToNextChar, diff --git a/crates/television/input.rs b/crates/television/input.rs index 057055e..61bcc95 100644 --- a/crates/television/input.rs +++ b/crates/television/input.rs @@ -7,6 +7,7 @@ pub fn convert_action_to_input_request( match action { Action::AddInputChar(c) => Some(InputRequest::InsertChar(*c)), Action::DeletePrevChar => Some(InputRequest::DeletePrevChar), + Action::DeletePrevWord => Some(InputRequest::DeletePrevWord), Action::DeleteNextChar => Some(InputRequest::DeleteNextChar), Action::GoToPrevChar => Some(InputRequest::GoToPrevChar), Action::GoToNextChar => Some(InputRequest::GoToNextChar), diff --git a/crates/television/television.rs b/crates/television/television.rs index 72bd6bd..d2a0cf9 100644 --- a/crates/television/television.rs +++ b/crates/television/television.rs @@ -264,6 +264,7 @@ impl Television { // handle input actions Action::AddInputChar(_) | Action::DeletePrevChar + | Action::DeletePrevWord | Action::DeleteNextChar | Action::GoToInputEnd | Action::GoToInputStart