From f16bc4a7640a8895add431899b50eb4ec731b570 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Thu, 27 Mar 2025 16:38:28 +0100 Subject: [PATCH] fix(text_input): Backspace key ignored --- src/widget/text_input/input.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index 405e876..26665bb 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -1684,7 +1684,8 @@ pub fn update<'a, Message: Clone + 'static>( } } - if let Some(text) = text { + // Capture keyboard inputs that should be submitted. + if let Some(c) = text.and_then(|t| t.chars().next().filter(|c| !c.is_control())) { let Some(on_input) = on_input else { return event::Status::Ignored; }; @@ -1692,12 +1693,6 @@ pub fn update<'a, Message: Clone + 'static>( state.is_pasting = None; if !state.keyboard_modifiers.command() && !modifiers.control() { - let c = text.chars().next().filter(|c| !c.is_control()); - - let Some(c) = c else { - return event::Status::Captured; - }; - let mut editor = Editor::new(unsecured_value, &mut state.cursor); editor.insert(c);