You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-28 16:07:14 +00:00
[iOS] Nonnegative start index for virtual keyboard range
(cherry picked from commit 275772818d)
This commit is contained in:
committed by
Rémi Verschelde
parent
e4cbf9c58a
commit
2bd40b4c9c
@@ -87,13 +87,15 @@
|
|||||||
self.text = existingString;
|
self.text = existingString;
|
||||||
self.previousText = existingString;
|
self.previousText = existingString;
|
||||||
|
|
||||||
|
NSInteger safeStartIndex = MAX(start, 0);
|
||||||
|
|
||||||
NSRange textRange;
|
NSRange textRange;
|
||||||
|
|
||||||
// Either a simple cursor or a selection.
|
// Either a simple cursor or a selection.
|
||||||
if (end > 0) {
|
if (end > 0) {
|
||||||
textRange = NSMakeRange(start, end - start);
|
textRange = NSMakeRange(safeStartIndex, end - start);
|
||||||
} else {
|
} else {
|
||||||
textRange = NSMakeRange(start, 0);
|
textRange = NSMakeRange(safeStartIndex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.selectedRange = textRange;
|
self.selectedRange = textRange;
|
||||||
|
|||||||
Reference in New Issue
Block a user