提交 7c699ce7 编写于 作者: C Chris Bracken 提交者: GitHub

Clamp iOS selection to 0 < pos < length (#3636)

上级 c0f1e3b4
......@@ -169,8 +169,8 @@ static UIKeyboardType ToUIKeyboardType(NSString* inputType) {
NSInteger selectionBase = [state[@"selectionBase"] intValue];
NSInteger selectionExtent = [state[@"selectionExtent"] intValue];
NSUInteger start = MAX(0, MIN(selectionBase, selectionExtent));
NSUInteger end = MAX(0, MAX(selectionBase, selectionExtent));
NSUInteger start = MIN(MAX(0, MIN(selectionBase, selectionExtent)), (NSInteger)self.text.length);
NSUInteger end = MIN(MAX(0, MAX(selectionBase, selectionExtent)), (NSInteger)self.text.length);
NSRange selectedRange = NSMakeRange(start, end - start);
[self setSelectedTextRange:[FlutterTextRange rangeWithNSRange:selectedRange]
updateEditingState:NO];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册