Prioritize text insertion in TextInput and TextEditor

This commit is contained in:
Héctor Ramón Jiménez 2024-02-21 13:00:34 +01:00
parent 56ac21cacb
commit 680e8425c3
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 31 additions and 30 deletions

View file

@ -686,6 +686,14 @@ impl Update {
text,
..
} if state.is_focused => {
if let Some(text) = text {
if let Some(c) =
text.chars().filter(|c| !c.is_control()).next()
{
return edit(Edit::Insert(c));
}
}
if let keyboard::Key::Named(named_key) = key.as_ref() {
if let Some(motion) = motion(named_key) {
let motion = if platform::is_jump_modifier_pressed(
@ -732,13 +740,7 @@ impl Update {
{
Some(Self::Paste)
}
_ => {
let text = text?;
edit(Edit::Insert(
text.chars().next().unwrap_or_default(),
))
}
_ => None,
}
}
_ => None,