From bc0d1ab94a3ca9c264a2244bfcc98cc9ae1cffea Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Tue, 24 Dec 2024 00:08:43 +0100 Subject: [PATCH] ctrl-backspace to delete words in text input --- src/ui.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui.rs b/src/ui.rs index 4c80f7d..a7c2f49 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -267,6 +267,13 @@ pub fn text_input( if d.is_key_pressed(KeyboardKey::KEY_BACKSPACE) && !text.is_empty() { changed = true; text.pop(); + if d.is_key_down(KeyboardKey::KEY_LEFT_CONTROL) { + while let Some(c) = text.pop() { + if c == ' ' { + break; + } + } + } } if text.len() < max_len { let char_code = unsafe { ffi::GetCharPressed() };