From 0d2bbcfce6b70e7da802afce1930a931575e132d Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 27 May 2019 09:21:19 -0700 Subject: [PATCH] lineedit: add ctrl-w to delete word up to cursor --- termwiz/src/lineedit/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/termwiz/src/lineedit/mod.rs b/termwiz/src/lineedit/mod.rs index 7259019b7..e4d769d91 100644 --- a/termwiz/src/lineedit/mod.rs +++ b/termwiz/src/lineedit/mod.rs @@ -29,6 +29,7 @@ //! Ctrl-J, Ctrl-M, Enter | Finish line editing and accept the current line //! Ctrl-K | Delete from cursor to end of line //! Ctrl-L | Move the cursor to the top left, clear screen and repaint +//! Ctrl-W | Delete word leading up to cursor //! Alt-b, Alt-Left | Move the cursor backwards one word //! Alt-f, Alt-Right | Move the cursor forwards one word use crate::caps::{Capabilities, ProbeHintsBuilder}; @@ -160,6 +161,12 @@ impl LineEditor { modifiers: Modifiers::NONE, }) => Some(Action::Move(Movement::BackwardChar(1))), + InputEvent::Key(KeyEvent { + key: KeyCode::Char('W'), + modifiers: Modifiers::CTRL, + }) + => Some(Action::Kill(Movement::BackwardWord(1))), + InputEvent::Key(KeyEvent { key: KeyCode::Char('b'), modifiers: Modifiers::ALT,