这是indexloc提供的服务,不要输入任何密码
Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fixes Korea cursor position bug #170798

wants to merge 2 commits into from

Conversation

Mkkas3145
Copy link

@Mkkas3145 Mkkas3145 commented Jun 18, 2025

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.

  1. Hangul combination synchronization problem

Fixes #140739

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

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.

Copy link

google-cla bot commented Jun 18, 2025

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.

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Jun 18, 2025
@justinmc justinmc changed the title Fixed issue #140739 Fixes Korea cursor position bug Jun 26, 2025
@@ -2255,6 +2255,11 @@ class TextInput {
return;
}

// Fixes issues related to composing characters such as Hangul. (Testing is unnecessary.)
Copy link
Contributor

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.

Comment on lines +2259 to +2261
if (value.composing.isValid) {
value = value.copyWith(selection: TextSelection.collapsed(offset: value.composing.end));
}
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

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).

@flutter-dashboard
Copy link

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 package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When entering Korean, the text cursor is behind single space.
2 participants