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

Fix deleting text when the last character is some special characters on IOS #7982

Merged
merged 12 commits into from
Mar 8, 2019
Merged

Fix deleting text when the last character is some special characters on IOS #7982

merged 12 commits into from
Mar 8, 2019

Conversation

HelloCore
Copy link
Contributor

On iOS, we cannot delete last character if it is some special characters, for example, , , , or

As you can see here.
flutter/flutter#24203
flutter/flutter#21745

After I debugged it, I found that _selectedTextRange.isEmpty happened to be true for this specific case.
Morover, I found that it called - (void)setSelectedTextRange:(UITextRange*)selectedTextRange before - (void)deleteBackward on the normal case, but it wasn't called on this case.

@sittipongsaladaeng
Copy link

@GaryQian Please solve this issue.

@SupakornTeam
Copy link

@GaryQian
We want to edit this part. Please solve this issue.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@HelloCore
Copy link
Contributor Author

She’s signed it.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@MechinMaru
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

I'm OK.

@GaryQian
Copy link
Contributor

GaryQian commented Feb 28, 2019

@MechinMaru Hey, to satisfy the CLA bots, could you make sure you have signed (https://cla.developers.google.com/clas) and comment I signed it! on this PR? Thanks!

@MechinMaru
Copy link

I signed it!

@MechinMaru
Copy link

I signed it at Feb 28, 2019 07:03 PST.
I think bot confused about this.

@GaryQian
Copy link
Contributor

GaryQian commented Mar 1, 2019

Ok, have verified everything is signed, and you have commented that you are ok with contributing this code to Flutter.

I'll take a look at this soon too. cc @cbracken for some Obj-C magic review

@GaryQian GaryQian requested a review from cbracken March 1, 2019 18:30
@GaryQian GaryQian added cla: yes and removed cla: no labels Mar 1, 2019
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no and removed cla: yes labels Mar 7, 2019
@HelloCore
Copy link
Contributor Author

Thank you for reviewing.

As I investigated, I found that UIKeyboardImpl called

  • - (UITextPosition*)positionFromPosition:(UITextPosition*)position offset:(NSInteger)offset with offset is -1
  • - (UITextRange*)textRangeFromPosition:(UITextPosition*)fromPosition toPosition:(UITextPosition*)toPosition
  • - (void)setSelectedTextRange:(UITextRange*)selectedTextRange with new textRange
  • - (void)deleteBackward

However, in case of Thai vowel, it skipped - (void)setSelectedTextRange:, so _selectedTextRange is going to be empty.
Moreover, when I modified - (UITextPosition*)positionFromPosition to return previous codepoint, I found that it happened to call - (void)setSelectedTextRange: correctly.

So, I think UIKeyboardImpl did some magical things that made them be able to distinguish between grapheme cluster that had to be completely deleted, and partly deleted.

I think it's not going to break current behavior because it called - (void)setSelectedTextRange:, so _selectedTextRange wouldn't be empty for other cases.

Copy link
Contributor

@GaryQian GaryQian left a comment

Choose a reason for hiding this comment

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

Well, this LGTM!

Thanks for researching and fixing this bug!

I'll leave this open for a bit to see if @cbracken has any final concerns, and ill look for an opportunity to land it!

(I'll manually change the CLA tag again just before landing to avoid more clabot spam)

@GaryQian GaryQian added cla: yes and removed cla: no labels Mar 8, 2019
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@GaryQian GaryQian merged commit 260669c into flutter:master Mar 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 8, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Mar 9, 2019
flutter/engine@6031407...87edd94

git log 6031407..87edd94 --no-merges --oneline
87edd94 Add read-only persistent cache (flutter/engine#8049)
4c94049 Move android_sdk_downloader so I can more easily deprecate it (flutter/engine#8084)
7cbd9d8 Roll src/third_party/skia 3d1b941f3a7d..bea1f94f341e (7 commits) (flutter/engine#8083)
260669c Fix deleting text when the last character is some special characters on IOS (flutter/engine#7982)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff (mklim@google.com), and stop
the roller if necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants