From 21d045e8eff2c69e63b39004f74fd0e65bc2caaf Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Fri, 22 Mar 2024 20:27:08 +0900 Subject: [PATCH] Fix: IME bug when typing Chinese characters (#4210) * Closes #4209 Fix: IME bug when typing Chinese characters --- crates/egui/src/widgets/text_edit/builder.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index 12077b93292..3c4f6c51e7c 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -953,7 +953,10 @@ fn events( if prediction != "\n" && prediction != "\r" { state.has_ime = false; let mut ccursor; - if !prediction.is_empty() && cursor_range == state.ime_cursor_range { + if !prediction.is_empty() + && cursor_range.secondary.ccursor.index + == state.ime_cursor_range.secondary.ccursor.index + { ccursor = text.delete_selected(&cursor_range); text.insert_text_at(&mut ccursor, prediction, char_limit); } else {