From 1efa66014981b39f0357b8a49599e7266a96ad79 Mon Sep 17 00:00:00 2001 From: Frank Lee <603128423@qq.com> Date: Thu, 4 Jan 2024 22:47:49 +0800 Subject: [PATCH] Fix IME input of `CompositionEnd` without a `CompositionStart` (#3768) * Closes https://github.com/emilk/egui/issues/3766 Add support for type in CompositionEnd only characters without trigger CompositionStart first. This usually works with no-latin character input. --------- Co-authored-by: Emil Ernerfeldt --- crates/egui/src/widgets/text_edit/builder.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index 3d6ecb18..1a2243a9 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -1050,7 +1050,8 @@ fn events( } Event::CompositionEnd(prediction) => { - if prediction != "\n" && prediction != "\r" && state.has_ime { + // CompositionEnd only characters may be typed into TextEdit without trigger CompositionStart first, so do not check `state.has_ime = true` in the following statement. + if prediction != "\n" && prediction != "\r" { state.has_ime = false; let mut ccursor = delete_selected(text, &cursor_range); if !prediction.is_empty() {