[iOS] Nonnegative start index for virtual keyboard range
(cherry picked from commit 275772818d
)
This commit is contained in:
parent
5a20cef857
commit
f9535554fa
|
@ -87,13 +87,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