diff options
author | 2025-02-03 18:38:20 +0100 | |
---|---|---|
committer | 2025-02-03 18:38:20 +0100 | |
commit | bab18858cd60168b63ae442026f45a90eb6be731 (patch) | |
tree | 0e6a16e9fee7e2eb474c7b5726d3aadc0685044d /widget | |
parent | 50eaef28447f453bc90133de19cff8b2bfee27de (diff) | |
download | iced-bab18858cd60168b63ae442026f45a90eb6be731.tar.gz iced-bab18858cd60168b63ae442026f45a90eb6be731.tar.bz2 iced-bab18858cd60168b63ae442026f45a90eb6be731.zip |
Handle pre-edits and commits only if `text_editor` is focused
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/text_editor.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index 486741c6..cfdf6b5d 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -758,14 +758,10 @@ where shell.request_redraw(); } Ime::Preedit { content, selection } => { - if state.focus.is_some() { - state.preedit = Some(input_method::Preedit { - content, - selection, - }); + state.preedit = + Some(input_method::Preedit { content, selection }); - shell.request_redraw(); - } + shell.request_redraw(); } Ime::Commit(text) => { shell.publish(on_edit(Action::Edit(Edit::Paste( @@ -1284,15 +1280,20 @@ impl<Message> Update<Message> { input_method::Event::Opened )))) } - input_method::Event::Preedit(content, selection) => { + input_method::Event::Preedit(content, selection) + if state.focus.is_some() => + { Some(Update::InputMethod(Ime::Preedit { content, selection, })) } - input_method::Event::Commit(content) => { + input_method::Event::Commit(content) + if state.focus.is_some() => + { Some(Update::InputMethod(Ime::Commit(content))) } + _ => None, }, Event::Keyboard(keyboard::Event::KeyPressed { key, |