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: Ensures correct IME behavior when the text input area gains or loses focus. #4896

Merged
merged 9 commits into from
Aug 28, 2024

Conversation

rustbasic
Copy link
Contributor

@rustbasic rustbasic commented Aug 1, 2024

Fix: Ensures correct IME behavior when the text input area gains or loses focus.

Fix: Handling state.ime_enabled in multiple TextEdit.
Fix: A symptom of characters being copied when there are multiple TextEdits.

Fix Issues: When focus is moved elsewhere, you must set state.ime_enabled = false, otherwise the IME will have problems when focus returns.

Fix Issues: A symptom of characters being copied when there are multiple TextEdits.
Deletes all current IME events, preventing them from being copied to other TextEdits, without saving the TextEdit ID,

( Related Issues: Some LINUX seem to trigger an IME enable event on startup. So, when we gained focus, we do state.ime_enabled = false. )

@@ -746,6 +746,10 @@ impl<'t> TextEdit<'t> {
}
}

if state.ime_enabled && response.lost_focus() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldnt you just leave the state.ime_enabled` ? Because if its true its getting set to false and else it is already false, so to me it seems like an unnecessary condition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldnt you just leave the state.ime_enabled` ? Because if its true its getting set to false and else it is already false, so to me it seems like an unnecessary condition

When focus is moved elsewhere, you must set ime_enabled to 'false`, otherwise the IME will have problems when focus returns.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure the idea was the following

if response.lost_focus() {
state.ime_enabled = false;
}

Copy link
Contributor Author

@rustbasic rustbasic Aug 3, 2024

Choose a reason for hiding this comment

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

sure the idea was the following

if response.lost_focus() {
state.ime_enabled = false;
}

Yes, I thought about this too. If ime_enabled is not true, there is no need to check lost_focus() , so there is a difference in speed and readability. Let's wait for emilk's opinion on which one is better.

thank you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok but if so it would be good to add a comment there anyway

@rustbasic rustbasic changed the title Fix: Handling state.ime_enabled in multiple TextEdit. Fix: IME-related processing when focus is lost in IME enabled state. Aug 4, 2024
emilk pushed a commit that referenced this pull request Aug 5, 2024
Fix: Changed the handling method of `Ime::Preedit(_, None)`

Fix: backspace fail after ime input

* Related #4358
* Related #4430 
* Related #4436
* Related #4794 
* Related #4896
* Closes #4908 

Issues: backspace fail after ime input
* #4908 (Chinese)

Changed the handling method of `Ime::Preedit(_, None)`
@rustbasic rustbasic changed the title Fix: IME-related processing when focus is lost in IME enabled state. Fix: IME-related processing when focus is gained or lost in IME enabled state. Aug 27, 2024
@rustbasic rustbasic changed the title Fix: IME-related processing when focus is gained or lost in IME enabled state. Fix: Ensures correct IME behavior when the text input area gains or loses focus. Aug 27, 2024
@emilk emilk added the IME label Aug 27, 2024
@emilk emilk added the egui label Aug 28, 2024
@emilk emilk merged commit 8e5492b into emilk:master Aug 28, 2024
20 of 21 checks passed
rib pushed a commit to EmbarkStudios/egui that referenced this pull request Sep 30, 2024
Fix: Changed the handling method of `Ime::Preedit(_, None)`

Fix: backspace fail after ime input

* Related emilk#4358
* Related emilk#4430 
* Related emilk#4436
* Related emilk#4794 
* Related emilk#4896
* Closes emilk#4908 

Issues: backspace fail after ime input
* emilk#4908 (Chinese)

Changed the handling method of `Ime::Preedit(_, None)`
486c pushed a commit to 486c/egui that referenced this pull request Oct 9, 2024
Fix: Changed the handling method of `Ime::Preedit(_, None)`

Fix: backspace fail after ime input

* Related emilk#4358
* Related emilk#4430 
* Related emilk#4436
* Related emilk#4794 
* Related emilk#4896
* Closes emilk#4908 

Issues: backspace fail after ime input
* emilk#4908 (Chinese)

Changed the handling method of `Ime::Preedit(_, None)`
486c pushed a commit to 486c/egui that referenced this pull request Oct 9, 2024
…oses focus. (emilk#4896)

Fix: Ensures correct IME behavior when the text input area gains or
loses focus.

Fix: Handling `state.ime_enabled` in multiple `TextEdit`.
Fix: A symptom of characters being copied when there are multiple
TextEdits.

* Related emilk#4137
* Related emilk#4358 
* Closes emilk#4374
* Related emilk#4436
* Related emilk#4794 
* Related emilk#4908 

* Related emilk#5008

Fix Issues: When focus is moved elsewhere, you must set
`state.ime_enabled = false`, otherwise the IME will have problems when
focus returns.

Fix Issues: A symptom of characters being copied when there are multiple
TextEdits.
Deletes all current `IME events`, preventing them from being copied to
`other TextEdits`, without saving the `TextEdit ID`,

( Related Issues: Some `LINUX` seem to trigger an IME enable event on
startup. So, when we gained focus, we do `state.ime_enabled = false`. )
hacknus pushed a commit to hacknus/egui that referenced this pull request Oct 30, 2024
Fix: Changed the handling method of `Ime::Preedit(_, None)`

Fix: backspace fail after ime input

* Related emilk#4358
* Related emilk#4430 
* Related emilk#4436
* Related emilk#4794 
* Related emilk#4896
* Closes emilk#4908 

Issues: backspace fail after ime input
* emilk#4908 (Chinese)

Changed the handling method of `Ime::Preedit(_, None)`
hacknus pushed a commit to hacknus/egui that referenced this pull request Oct 30, 2024
…oses focus. (emilk#4896)

Fix: Ensures correct IME behavior when the text input area gains or
loses focus.

Fix: Handling `state.ime_enabled` in multiple `TextEdit`.
Fix: A symptom of characters being copied when there are multiple
TextEdits.

* Related emilk#4137
* Related emilk#4358 
* Closes emilk#4374
* Related emilk#4436
* Related emilk#4794 
* Related emilk#4908 

* Related emilk#5008

Fix Issues: When focus is moved elsewhere, you must set
`state.ime_enabled = false`, otherwise the IME will have problems when
focus returns.

Fix Issues: A symptom of characters being copied when there are multiple
TextEdits.
Deletes all current `IME events`, preventing them from being copied to
`other TextEdits`, without saving the `TextEdit ID`,

( Related Issues: Some `LINUX` seem to trigger an IME enable event on
startup. So, when we gained focus, we do `state.ime_enabled = false`. )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants