1
0
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:
Sergey Minakov
2021-04-30 11:40:12 +03:00
committed by Rémi Verschelde
parent e4cbf9c58a
commit 2bd40b4c9c

View File

@@ -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;