Request redraws on InputMethod events

This commit is contained in:
Héctor Ramón Jiménez 2025-02-03 16:55:10 +01:00
parent 76c25d2fb2
commit e8c680ce66
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 9 additions and 1 deletions

View file

@ -754,6 +754,8 @@ where
Ime::Toggle(is_open) => { Ime::Toggle(is_open) => {
state.preedit = state.preedit =
is_open.then(input_method::Preedit::new); is_open.then(input_method::Preedit::new);
shell.request_redraw();
} }
Ime::Preedit { content, selection } => { Ime::Preedit { content, selection } => {
if state.focus.is_some() { if state.focus.is_some() {
@ -761,6 +763,8 @@ where
content, content,
selection, selection,
}); });
shell.request_redraw();
} }
} }
Ime::Commit(text) => { Ime::Commit(text) => {

View file

@ -36,13 +36,13 @@ mod value;
pub mod cursor; pub mod cursor;
pub use cursor::Cursor; pub use cursor::Cursor;
use iced_runtime::core::input_method;
pub use value::Value; pub use value::Value;
use editor::Editor; use editor::Editor;
use crate::core::alignment; use crate::core::alignment;
use crate::core::clipboard::{self, Clipboard}; use crate::core::clipboard::{self, Clipboard};
use crate::core::input_method;
use crate::core::keyboard; use crate::core::keyboard;
use crate::core::keyboard::key; use crate::core::keyboard::key;
use crate::core::layout; use crate::core::layout;
@ -1257,6 +1257,8 @@ where
state.is_ime_open = state.is_ime_open =
matches!(event, input_method::Event::Opened) matches!(event, input_method::Event::Opened)
.then(input_method::Preedit::new); .then(input_method::Preedit::new);
shell.request_redraw();
} }
input_method::Event::Preedit(content, selection) => { input_method::Event::Preedit(content, selection) => {
let state = state::<Renderer>(tree); let state = state::<Renderer>(tree);
@ -1266,6 +1268,8 @@ where
content: content.to_owned(), content: content.to_owned(),
selection: selection.clone(), selection: selection.clone(),
}); });
shell.request_redraw();
} }
} }
input_method::Event::Commit(text) => { input_method::Event::Commit(text) => {