Skip to content

Commit

Permalink
Fix entering text with compose key
Browse files Browse the repository at this point in the history
Previously entering text in text inputs with the compose key would insert one
or more NUL bytes before the inserted character.
  • Loading branch information
jasonrhansen authored and jackpot51 committed Jan 6, 2025
1 parent e162c59 commit aaa2ba3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/widget/text_input/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit aaa2ba3

Please sign in to comment.