Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0e10ead

Browse files
committed
format
1 parent e2d32f1 commit 0e10ead

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,8 @@ - (void)testFirstRectForRangeReturnsNoneZeroRectWhenScribbleIsEnabled {
15781578
XCTAssertTrue(CGRectEqualToRect(CGRectMake(100, 0, 300, 100),
15791579
[inputView firstRectForRange:multiRectRange]));
15801580
} else {
1581-
XCTAssertTrue(CGRectEqualToRect(CGRectMake(100, 0, 100, 100), [inputView firstRectForRange:multiRectRange]));
1581+
XCTAssertTrue(CGRectEqualToRect(CGRectMake(100, 0, 100, 100),
1582+
[inputView firstRectForRange:multiRectRange]));
15821583
}
15831584
}
15841585

0 commit comments

Comments
 (0)