mirror of https://github.com/libsdl-org/SDL.git
make start&length represent utf32 indices
This commit is contained in:
parent
9d06145d6c
commit
9a607e886e
|
|
@ -133,8 +133,12 @@
|
||||||
// This key event was consumed by the IME
|
// This key event was consumed by the IME
|
||||||
[self clearPendingKey];
|
[self clearPendingKey];
|
||||||
|
|
||||||
|
NSUInteger utf32SelectedRangeLocation = [[aString substringToIndex:selectedRange.location] lengthOfBytesUsingEncoding:NSUTF32StringEncoding] / 4;
|
||||||
|
NSUInteger utf32SelectionRangeEnd = [[aString substringToIndex:(selectedRange.location + selectedRange.length)] lengthOfBytesUsingEncoding:NSUTF32StringEncoding] / 4;
|
||||||
|
NSUInteger utf32SelectionRangeLength = utf32SelectionRangeEnd - utf32SelectedRangeLocation;
|
||||||
|
|
||||||
SDL_SendEditingText([aString UTF8String],
|
SDL_SendEditingText([aString UTF8String],
|
||||||
(int)selectedRange.location, (int)selectedRange.length);
|
(int)utf32SelectedRangeLocation, (int)utf32SelectionRangeLength);
|
||||||
|
|
||||||
DEBUG_IME(@"setMarkedText: %@, (%d, %d) replacement range (%d, %d)", _markedText,
|
DEBUG_IME(@"setMarkedText: %@, (%d, %d) replacement range (%d, %d)", _markedText,
|
||||||
(int)selectedRange.location, (int)selectedRange.length,
|
(int)selectedRange.location, (int)selectedRange.length,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue