-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Fixes Korea cursor position bug #170798
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
base: master
Are you sure you want to change the base?
Fixes Korea cursor position bug #170798
Conversation
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@@ -2255,6 +2255,11 @@ class TextInput { | |||
return; | |||
} | |||
|
|||
// Fixes issues related to composing characters such as Hangul. (Testing is unnecessary.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this does require a test! It should be pretty testable if I'm understanding correctly. You can enter composing text with TextEditingValue.composing.
if (value.composing.isValid) { | ||
value = value.copyWith(selection: TextSelection.collapsed(offset: value.composing.end)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My hunch is that there is a more fundamental bug under the hood here. Maybe the IME state is different from what Flutter thinks it is. Especially because this is Windows-specific.
What happens if you try inserting some composing text into the middle of a string? Does this solution break down?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like shown in the video, even if you compose Korean characters in the middle of a string, this method works correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this is the correct logic that we should be doing then? It seems like a hack to me, but I have to admit that my knowledge of Korean and other languages that use composition is poor, so I'm grateful for help from people like you!
It seems to me like this would break other things (maybe see the failing tests).
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Before:
https://github.com/user-attachments/assets/c78dddd8-f490-4663-8bf5-f4ca8c23c9ae
After:
https://github.com/user-attachments/assets/f671e3e0-cea8-4c1d-b635-f4ef21bd1594
List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.
Fixes #140739
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.