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

TextEdit: Discard the preedit when focus change or other text is enter #3000

Merged
merged 2 commits into from Jun 28, 2023

Conversation

ogoffart
Copy link
Member

Otherwise we end up with outdated pre-edit data if we change focus while editing.

Note: Qt doas actually send a "commit" event when the focus change (but of course that does not happen when changing the focus within slint)
But firefox does discard the preedit when loosing the focus.

CC #1925

Otherwise we end up with outdated pre-edit data if we change focus while
editing.

Note: Qt doas actually send a "commit" event when the focus change
(but of course that does not happen when changing the focus within
slint)
But firefox does discard the preedit when loosing the focus.

CC #1925
@ogoffart ogoffart requested a review from tronical June 27, 2023 15:52
@ogoffart
Copy link
Member Author

Please note that i don't really know what i'm doing.

@hunger
Copy link
Member

hunger commented Jun 28, 2023

I never used IME either (nor do I speak a language that needs IME, so even when I bring up IME, I have no idea what the desired behavior is), but I would expect some UI to come up. Won't that take away focus from our UI? Can that loss of focus interfere with the preedit text now?

internal/core/items/text.rs Outdated Show resolved Hide resolved
Comment on lines +970 to +972
self.preedit_text.set(Default::default());
self.preedit_selection_start.set(0);
self.preedit_selection_end.set(0);
Copy link
Member

Choose a reason for hiding this comment

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

This might or might not help, but it carries the risk of the input method being out of sync with the state that we think it is in. When the text of the input field changes, we should inform the input method about what the new text is. Qt has APIs for that, winit unfortunately doesn't.

@ogoffart
Copy link
Member Author

but I would expect some UI to come up. Won't that take away focus from our UI? Can that loss of focus interfere with the preedit text now?

no it won't, if it did, the preedit would never reach the right line edit. (the UI that comes up don't have the focus iself)

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
@ogoffart ogoffart merged commit a0dd643 into master Jun 28, 2023
3 of 23 checks passed
@ogoffart ogoffart deleted the olivier/fix-1925 branch June 28, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants