-
Notifications
You must be signed in to change notification settings - Fork 6k
[ios17][text_input]fix chinese language switch freeze, and missing auto correction menu in iOS 17 #46591
[ios17][text_input]fix chinese language switch freeze, and missing auto correction menu in iOS 17 #46591
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -619,6 +619,20 @@ - (UITextRange*)rangeEnclosingPosition:(UITextPosition*)position | |
| } | ||
|
|
||
| - (UITextRange*)lineEnclosingPosition:(UITextPosition*)position { | ||
| // TODO(hellohuanlin): Remove iOS 17 check. The same logic should apply to older versions too. | ||
| if (@available(iOS 17.0, *)) { | ||
| FlutterTextPosition* flutterPosition = (FlutterTextPosition*)position; | ||
| if (flutterPosition.index > _textInputView.text.length) { | ||
| return nil; | ||
| } | ||
| // end of document with forward affinity is still considered as part of the document, which is | ||
| // used by voice control's delete line command. | ||
| if (flutterPosition.index == _textInputView.text.length && | ||
| flutterPosition.affinity == UITextStorageDirectionBackward) { | ||
| return nil; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would happen if this returns the last line?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we return the last line, we will see the 2 bugs linked in my description.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can play around with it more tomorrow, but afaik apple's sample project uses exclusive endOfDocument. (It does not use affinity tho)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah cursor position and text position have different end positions. I'm not sure which one |
||
| } | ||
| } | ||
|
|
||
| // Gets the first line break position after the input position. | ||
| NSString* textAfter = [_textInputView | ||
| textInRange:[_textInputView textRangeFromPosition:position | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.