Skip to content

Commit

Permalink
Fix IME input of CompositionEnd without a CompositionStart (#3768)
Browse files Browse the repository at this point in the history
* Closes #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 <[email protected]>
  • Loading branch information
FrankLeeC and emilk authored Jan 4, 2024
1 parent f25e417 commit 1efa660
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/egui/src/widgets/text_edit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 1efa660

Please sign in to comment.