@@ -1688,9 +1688,8 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
16881688 CGFloat minY = CGFLOAT_MAX;
16891689 CGFloat maxY = CGFLOAT_MIN;
16901690
1691- FlutterTextRange* textRange =
1692- [FlutterTextRange rangeWithNSRange: fml: :RangeForCharactersInRange (
1693- self .text, NSMakeRange (0 , self .text.length))];
1691+ FlutterTextRange* textRange = [FlutterTextRange
1692+ rangeWithNSRange: fml: :RangeForCharactersInRange (self .text, NSMakeRange (0 , self .text.length))];
16941693 for (NSUInteger i = 0 ; i < [_selectionRects count ]; i++) {
16951694 BOOL startsOnOrBeforeStartOfRange = _selectionRects[i].position <= first;
16961695 BOOL isLastSelectionRect = i + 1 == [_selectionRects count ];
@@ -1699,12 +1698,14 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
16991698 !isLastSelectionRect && _selectionRects[i + 1 ].position > first;
17001699 if (startsOnOrBeforeStartOfRange &&
17011700 (endOfTextIsAfterStartOfRange || nextSelectionRectIsAfterStartOfRange)) {
1702- if (@available (iOS 17.0 , *)) {
1701+ // TODO(hellohaunlin): Remove iOS 17 check. The logic should also work for older versions.
1702+ if (@available (iOS 17 , *)) {
17031703 startSelectionRect = _selectionRects[i].rect ;
17041704 } else {
1705- // The iOS 17 system highlight does not repect the height returned by `firstRectForRange` API.
1706- // So we return CGRectZero to hide it.
1707- // However, for iPad scribble, at least 1 character's width is required for advanced gestures (e.g. insert a space with a vertical bar)
1705+ // The iOS 17 system highlight does not repect the height returned by `firstRectForRange`
1706+ // API. So we return CGRectZero to hide it. However, for iPad scribble, at least 1
1707+ // character's width is required for advanced gestures (e.g. insert a space with a vertical
1708+ // bar)
17081709 return [self isScribbleAvailable ] ? _selectionRects[i].rect : CGRectZero;
17091710 }
17101711 }
0 commit comments