From ff4e0b7e640f521853753df7a1f4b0307c9d871f Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 14 Apr 2024 15:28:58 +0900 Subject: [PATCH] Update builder.rs --- crates/egui/src/widgets/text_edit/builder.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index 30d04cbdbe7..fe1f7431994 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -950,15 +950,21 @@ fn events( .. } => check_for_mutating_key_press(os, &mut cursor_range, text, galley, modifiers, *key), - Event::CompositionStart => { + Event::ImeDisable => { + state.has_ime = false; + None + } + + Event::ImeEnable | Event::CompositionStart => { state.has_ime = true; + state.ime_cursor_range = cursor_range; None } Event::CompositionUpdate(text_mark) => { // empty prediction can be produced when user press backspace // or escape during ime. We should clear current text. - if text_mark != "\n" && text_mark != "\r" && state.has_ime { + if text_mark != "\n" && text_mark != "\r" { let mut ccursor = text.delete_selected(&cursor_range); let start_cursor = ccursor; if !text_mark.is_empty() {