-
Notifications
You must be signed in to change notification settings - Fork 6k
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 cursor jumping when typing some special characters. #7964
Conversation
Thanks for looking at this! Let me know when this is ready for review! |
It caused bug on some cases, so better keep old logic and add exception for this case
Thank you, I think it's ready now. 🎉 |
Thanks for looking into this issue! I left some suggestions, and I'll go ahead and build this and test it locally. Please make sure this is tested so that we dont break this in the future, (see https://github.com/flutter/flutter/wiki/Tree-hygiene). Tests for this would belong in paragraph_unittests.cc, you should be able to follow the format of the existing tests for getRectsForRange. Run the tests by building a host_debug_unopt build, going to |
Thank you for reviewing the code and your suggestions. I really appreciate it. 🙏 I mainly used OSX, and I found that some tests were failed on OSX. I believe this is correct, but it makes a little bit harder to test because I have to comment it, and make sure that I don't commit it in the future. 😢 Also, I couldn't use font |
Yeah unfortunately due to platform font loading and interpretation differences, we only run txt_unittests on Linux. I'll take another look in the morning! |
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.
LGTM! Thanks for your contribution! I'll take a look at your other PR too when I get a moment. I hugely appreciate your insight into solving the issue with Thai!
Just a very minor cosmetic comment, and this should be good to go.
Thank you for your effort to review my code! |
flutter/engine@99f3f7a9c Fix incorrect transformation matrix (flutter/engine#8001) flutter/engine@c88b09710 Roll src/third_party/skia b7b2da871e95..255569187f27 (23 commits) (flutter/engine#8002) flutter/engine@302e2e9d2 Fix cursor jumping when typing some special characters. (flutter/engine#7964) flutter/engine@fe15149d1 Android Embedding PR 12: Add lifecycle methods to FlutterActivity. (flutter/engine#7974) flutter/engine@6145e9046 Android Embedding PR 13: Integrated text input, keyevent input, and some other channel comms in FlutterView. (flutter/engine#7979)
flutter/engine@99f3f7a9c Fix incorrect transformation matrix (flutter/engine#8001) flutter/engine@c88b09710 Roll src/third_party/skia b7b2da871e95..255569187f27 (23 commits) (flutter/engine#8002) flutter/engine@302e2e9d2 Fix cursor jumping when typing some special characters. (flutter/engine#7964) flutter/engine@fe15149d1 Android Embedding PR 12: Add lifecycle methods to FlutterActivity. (flutter/engine#7974) flutter/engine@6145e9046 Android Embedding PR 13: Integrated text input, keyevent input, and some other channel comms in FlutterView. (flutter/engine#7979)
Trust GlyphPosition instead of the offset that came from Dart because Dart sees a combined character as multiple characters.
For example, when we type
สี
, it will callGetRectsForRange
twice.Which
start = 0, end = 1
andstart = 1, end = 2
However, when I looked at
GlyphPosition
on the second time, I gotgp.code_units.start = 0
andgp.code_units.end = 2
, which makes it skip the measuring becausegp.code_units.start < start
.Relate to:
flutter/flutter#21745