Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IME input of CompositionEnd without a CompositionStart #3768

Merged
merged 2 commits into from Jan 4, 2024

Conversation

FrankLeeC
Copy link
Contributor

@FrankLeeC FrankLeeC commented Jan 4, 2024

Add support for type in CompositionEnd only characters without trigger CompositionStart first.
This usually works with no-latin character input.

@emilk emilk added bug Something is broken egui labels Jan 4, 2024
@emilk emilk changed the title ISSUE#3766-bugfix. IME: TextEditor can not support CompositionEnd only input character Fix IME input of CompositionEnd without a CompositionStart Jan 4, 2024
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
@@ -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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still correct to check it for Event::CompositionUpdate above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page show that compositionstart could be fired after a user starts entering a Chinese character using a Pinyin, so when entering some word except compositionend character, componentstart fires and state.has_ime will always be true, and compositionupdate will work well. so it's still correct to check it for compositionupdate because state.has_ime is always true when entring word.

I have test the situation that remove all state.has_ime in CompositionStart, CompositionUpdate,CompositionEnd, it works well.

Also, state.has_ime is a variable that indicating current input state, maybe some other features will use this variable, so i think keep this variable is a good choice, although it seems useless at current time.

@emilk emilk merged commit 1efa660 into emilk:master Jan 4, 2024
19 checks passed
@FrankLeeC FrankLeeC deleted the ime_compositionend_bugfix branch January 5, 2024 00:32
@emilk emilk changed the title Fix IME input of CompositionEnd without a CompositionStart Fix IME input of CompositionEnd without a CompositionStart Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken egui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IME: TextEdit widget cannot support CompositionEnd only input character
2 participants