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 <emil.ernerfeldt@gmail.com>
This commit is contained in:
Frank Lee 2024-01-04 22:47:49 +08:00 committed by GitHub
parent f25e4171b9
commit 1efa660149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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() {