summaryrefslogtreecommitdiffstats
path: root/widget/src/text_editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/text_editor.rs')
-rw-r--r--widget/src/text_editor.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index a2a186f0..3c0a1806 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -649,6 +649,7 @@ impl Update {
keyboard::Event::KeyPressed {
key_code,
modifiers,
+ text,
} if state.is_focused => {
if let Some(motion) = motion(key_code) {
let motion =
@@ -678,12 +679,15 @@ impl Update {
{
Some(Self::Paste)
}
- _ => None,
+ _ => {
+ let text = text?;
+
+ edit(Edit::Insert(
+ text.chars().next().unwrap_or_default(),
+ ))
+ }
}
}
- keyboard::Event::CharacterReceived(c) if state.is_focused => {
- edit(Edit::Insert(c))
- }
_ => None,
},
_ => None,