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

Commit b2287dd

Browse files
committed
wip
1 parent 172ad1f commit b2287dd

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

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

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,12 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
16711671
}
16721672
}
16731673

1674+
if (@available(iOS 17.0, *)) {
1675+
// nothing
1676+
} else {
1677+
return CGRectZero;
1678+
}
1679+
16741680
NSUInteger first = start;
16751681
if (end < start) {
16761682
first = end;
@@ -1694,11 +1700,11 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
16941700
if (startsOnOrBeforeStartOfRange &&
16951701
(endOfTextIsAfterStartOfRange || nextSelectionRectIsAfterStartOfRange)) {
16961702
// TODO(hellohaunlin): Remove iOS 17 check. The logic should also work for older versions.
1697-
if (@available(iOS 17, *)) {
1698-
startSelectionRect = _selectionRects[i].rect;
1699-
} else {
1700-
return _selectionRects[i].rect;
1701-
}
1703+
// if (@available(iOS 17, *)) {
1704+
startSelectionRect = _selectionRects[i].rect;
1705+
// } else {
1706+
// return _selectionRects[i].rect;
1707+
// }
17021708
}
17031709
if (!CGRectIsNull(startSelectionRect)) {
17041710
minY = fmin(minY, CGRectGetMinY(_selectionRects[i].rect));
@@ -1723,6 +1729,7 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
17231729
// fmin/fmax to support both LTR and RTL languages.
17241730
CGFloat minX = fmin(CGRectGetMinX(startSelectionRect), CGRectGetMinX(endSelectionRect));
17251731
CGFloat maxX = fmax(CGRectGetMaxX(startSelectionRect), CGRectGetMaxX(endSelectionRect));
1732+
NSLog(@"text height is: %f", maxY - minY);
17261733
return CGRectMake(minX, minY, maxX - minX, maxY - minY);
17271734
}
17281735
}
@@ -2504,16 +2511,16 @@ - (void)setEditableSizeAndTransform:(NSDictionary*)dictionary {
25042511
// TODO(hellohuanlin): Also need to handle iOS 16 case, where the auto-correction highlight does
25052512
// not match the size of text.
25062513
// See https://github.com/flutter/flutter/issues/131695
2507-
if (@available(iOS 17, *)) {
2508-
// Move auto-correction highlight to overlap with the actual text.
2509-
// This is to fix an issue where the system auto-correction highlight is displayed at
2510-
// the top left corner of the screen on iOS 17+.
2511-
// This problem also happens on iOS 16, but the size of highlight does not match the text.
2512-
// See https://github.com/flutter/flutter/issues/131695
2513-
// TODO(hellohuanlin): Investigate if we can use non-zero size.
2514-
_inputHider.frame =
2515-
CGRectMake([transform[leftIndex] intValue], [transform[topIndex] intValue], 0, 0);
2516-
}
2514+
// if (@available(iOS 17, *)) {
2515+
// Move auto-correction highlight to overlap with the actual text.
2516+
// This is to fix an issue where the system auto-correction highlight is displayed at
2517+
// the top left corner of the screen on iOS 17+.
2518+
// This problem also happens on iOS 16, but the size of highlight does not match the text.
2519+
// See https://github.com/flutter/flutter/issues/131695
2520+
// TODO(hellohuanlin): Investigate if we can use non-zero size.
2521+
_inputHider.frame =
2522+
CGRectMake([transform[leftIndex] intValue], [transform[topIndex] intValue], 0, 0);
2523+
// }
25172524
}
25182525
}
25192526

0 commit comments

Comments
 (0)