fix(text_input): Backspace key ignored

This commit is contained in:
Michael Aaron Murphy 2025-03-27 16:38:28 +01:00
parent 0eb86850ce
commit f16bc4a764
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -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);