Merge pull request #48323 from naithar/fix/ios-virtual-keyboard-range
[iOS] Nonnegative start index for virtual keyboard range
This commit is contained in:
commit
a91effc791
|
@ -88,13 +88,15 @@
|
|||
self.text = existingString;
|
||||
self.previousText = existingString;
|
||||
|
||||
NSInteger safeStartIndex = MAX(start, 0);
|
||||
|
||||
NSRange textRange;
|
||||
|
||||
// Either a simple cursor or a selection.
|
||||
if (end > 0) {
|
||||
textRange = NSMakeRange(start, end - start);
|
||||
textRange = NSMakeRange(safeStartIndex, end - start);
|
||||
} else {
|
||||
textRange = NSMakeRange(start, 0);
|
||||
textRange = NSMakeRange(safeStartIndex, 0);
|
||||
}
|
||||
|
||||
self.selectedRange = textRange;
|
||||
|
|
Loading…
Reference in New Issue