From e45c58c4056cae543052332d0f0b5d2b7e08f102 Mon Sep 17 00:00:00 2001 From: Jason Rodney Hansen Date: Sun, 5 Jan 2025 15:29:17 -0700 Subject: [PATCH] Fix entering text with compose key Previously entering text in text inputs with the compose key would insert one or more NUL bytes before the inserted character. --- src/widget/text_input/input.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index f440b59c01f..80bd8b54094 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -1742,9 +1742,11 @@ where { let mut editor = Editor::new(unsecured_value, &mut state.cursor); - editor.insert( - text.unwrap_or_default().chars().next().unwrap_or_default(), - ); + let character = + text.unwrap_or_default().chars().next().unwrap_or_default(); + if !character.is_control() { + editor.insert(character); + } let contents = editor.contents(); let unsecured_value = Value::new(&contents); let message = (on_input)(contents);