From c4279c0a62777aceac64fd37d366e257f13d3528 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 17 Apr 2013 10:52:59 +1000 Subject: When setting composition text, correctly select the indicated text by converting range to bytes. --- cocoa/ScintillaView.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 48ccdf1ef..4fa6dcb54 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -437,10 +437,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) // Select the part which is indicated in the given range. It does not scroll the caret into view. if (range.length > 0) { - [mOwner setGeneralProperty: SCI_SETSELECTIONSTART - value: currentPosition + range.location]; - [mOwner setGeneralProperty: SCI_SETSELECTIONEND - value: currentPosition + range.location + range.length]; + // range is in characters so convert to bytes for selection. + int rangeStart = currentPosition; + for (size_t characterInComposition=0; characterInComposition