From 44918364c0ecc9dbc8f63aa9add7306c0f0d3035 Mon Sep 17 00:00:00 2001 From: kas Date: Fri, 10 Jul 2020 17:59:31 +0200 Subject: [PATCH] Add default action for delete key --- termwiz/src/lineedit/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/termwiz/src/lineedit/mod.rs b/termwiz/src/lineedit/mod.rs index 8bd629f48..039f5fb0d 100644 --- a/termwiz/src/lineedit/mod.rs +++ b/termwiz/src/lineedit/mod.rs @@ -29,6 +29,7 @@ //! Ctrl-D | Cancel the line editor with an End-of-File result //! Ctrl-F, Right | Move cursor one grapheme to the right //! Ctrl-H, Backspace | Delete the grapheme to the left of the cursor +//! Delete | Delete the grapheme to the right of the cursor //! 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 @@ -355,6 +356,13 @@ impl<'term> LineEditor<'term> { key: KeyCode::Backspace, modifiers: Modifiers::NONE, }) => Some(Action::Kill(Movement::BackwardChar(1))), + InputEvent::Key(KeyEvent { + key: KeyCode::Delete, + modifiers: Modifiers::NONE, + }) => Some(Action::KillAndMove( + Movement::ForwardChar(1), + Movement::None, + )), InputEvent::Key(KeyEvent { key: KeyCode::Char('P'),