Skip to content

Commit

Permalink
Update builder.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Apr 14, 2024
1 parent af3befd commit ff4e0b7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/egui/src/widgets/text_edit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit ff4e0b7

Please sign in to comment.