Skip to content

Commit

Permalink
Fix: IME bug when typing Chinese characters (#4210)
Browse files Browse the repository at this point in the history
* Closes #4209 

Fix: IME bug when typing Chinese characters
  • Loading branch information
rustbasic authored Mar 22, 2024
1 parent 7691996 commit 21d045e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/egui/src/widgets/text_edit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 21d045e

Please sign in to comment.