diff options
Diffstat (limited to 'platform/iphone/keyboard_input_view.mm')
-rw-r--r-- | platform/iphone/keyboard_input_view.mm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/platform/iphone/keyboard_input_view.mm b/platform/iphone/keyboard_input_view.mm index 1408f78e90..e2bd0acff4 100644 --- a/platform/iphone/keyboard_input_view.mm +++ b/platform/iphone/keyboard_input_view.mm @@ -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; @@ -136,8 +138,8 @@ break; } - DisplayServerIPhone::get_singleton()->key(character, true); - DisplayServerIPhone::get_singleton()->key(character, false); + DisplayServerIPhone::get_singleton()->key((Key)character, true); + DisplayServerIPhone::get_singleton()->key((Key)character, false); } } |