From 1cdbab1a1d70d08151a7625f17ef4c0bb5c7fead Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 26 Dec 2023 13:35:56 -0500 Subject: [PATCH] keyfork-prompt: allow delete-word --- keyfork-prompt/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keyfork-prompt/src/lib.rs b/keyfork-prompt/src/lib.rs index 4669cc6..1fed38b 100644 --- a/keyfork-prompt/src/lib.rs +++ b/keyfork-prompt/src/lib.rs @@ -8,7 +8,7 @@ use keyfork_mnemonic_util::Wordlist; use crossterm::{ cursor, - event::{read, Event, KeyCode}, + event::{read, Event, KeyCode, KeyModifiers}, style::{Print, PrintStyledContent, Stylize}, terminal, tty::IsTty, @@ -110,6 +110,9 @@ where KeyCode::Backspace => { input.pop(); } + KeyCode::Char('w') if k.modifiers.contains(KeyModifiers::CONTROL) => { + while input.pop().is_some_and(|c| !c.is_whitespace()) {} + } KeyCode::Char(' ') => { if !input.chars().rev().next().is_some_and(char::is_whitespace) { input.push(' ');