Set correct text size for preedit window#2790
Merged
hecrj merged 3 commits intoiced-rs:masterfrom Feb 12, 2025
Merged
Conversation
516b5f4 to
fcdf53a
Compare
hecrj
requested changes
Feb 5, 2025
core/src/input_method.rs
Outdated
Comment on lines
43
to
50
| pub fn new(text_size: Option<impl Into<Pixels>>) -> Self | ||
| where | ||
| T: Default, | ||
| { | ||
| Self::default() | ||
| Self { | ||
| text_size: text_size.map(Into::into), | ||
| ..Default::default() | ||
| } |
Member
There was a problem hiding this comment.
No need. Let's not ask for any argument and just use Default.
Contributor
Author
There was a problem hiding this comment.
Sure. I'll make a change.
Contributor
Author
Contributor
|
Thank you for working on follow-ups! I had an idea on this, which text widgets pass the caret height as a preedit style hint. Passing text style itself achieves high fidelity preedit, but we need to find balance to widgets requirement. |
Contributor
Author
|
@kenz-gelsoft Yeah, it's even better idea but it would require more design decisions. In this PR, I'd like to focus on only the text size as a quick fix. BTW let me say thank you for the bunch of the first work for adding IME support. It's definitely needed for CJK users 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Currently the text size of preedit window is fixed to
renderer.default_size(). However the text size of text input and text editor can be changed by user. Using same size for preedit window is more natural.before.mp4
Solution
This PR propagates the text size from the widget which requests IME to the window manager which manages the event loop. The propagated text size is used when the preedit window is rendered if available.
after.mp4