|
|
|
@ -775,10 +775,21 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt) |
|
|
|
markedText = (NSString*) string; |
|
|
|
} |
|
|
|
|
|
|
|
_markedRange = NSMakeRange(_selectedRange.location, [markedText length]); |
|
|
|
auto parent = _parent.tryGet(); |
|
|
|
|
|
|
|
if(parent->InputMethod->IsActive()){ |
|
|
|
// Delete any replaced range |
|
|
|
if (replacementRange.location != NSNotFound && parent != nullptr && parent->InputMethod->IsActive()) |
|
|
|
{ |
|
|
|
parent->InputMethod->Client->SelectInSurroundingText((int)replacementRange.location, (int)(replacementRange.location + replacementRange.length)); |
|
|
|
uint64_t timestamp = static_cast<uint64_t>([NSDate timeIntervalSinceReferenceDate] * 1000); |
|
|
|
parent->TopLevelEvents->RawKeyEvent(KeyDown, timestamp, AvnInputModifiersNone, AvnKeyBack, AvnPhysicalKeyNone, "\b"); |
|
|
|
parent->TopLevelEvents->RawKeyEvent(KeyUp, timestamp, AvnInputModifiersNone, AvnKeyBack, AvnPhysicalKeyNone, "\b"); |
|
|
|
} |
|
|
|
|
|
|
|
_markedRange = NSMakeRange(_selectedRange.location, [markedText length]); |
|
|
|
|
|
|
|
if (parent != nullptr && parent->InputMethod->IsActive()) |
|
|
|
{ |
|
|
|
parent->InputMethod->Client->SetPreeditText((char*)[markedText UTF8String]); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -807,9 +818,16 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt) |
|
|
|
if(actualRange){ |
|
|
|
range = *actualRange; |
|
|
|
} |
|
|
|
|
|
|
|
// From the docs: an implementation of this method should be prepared for aRange to be out of bounds. |
|
|
|
// In this case, you should return the intersection of the document's range and aRange. |
|
|
|
// If the location of aRange is completely outside of the document's range, return nil. |
|
|
|
auto finalRange = NSIntersectionRange(range, NSMakeRange(0, _text.length)); |
|
|
|
|
|
|
|
NSAttributedString* subString = [_text attributedSubstringFromRange:range]; |
|
|
|
if (finalRange.length == 0) |
|
|
|
return nil; |
|
|
|
|
|
|
|
NSAttributedString* subString = [_text attributedSubstringFromRange:finalRange]; |
|
|
|
return subString; |
|
|
|
} |
|
|
|
|
|
|
|
@ -819,9 +837,9 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt) |
|
|
|
if(parent == nullptr){ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
NSString* text; |
|
|
|
|
|
|
|
|
|
|
|
if([string isKindOfClass:[NSAttributedString class]]) |
|
|
|
{ |
|
|
|
text = [string string]; |
|
|
|
@ -831,6 +849,13 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt) |
|
|
|
text = (NSString*) string; |
|
|
|
} |
|
|
|
|
|
|
|
if (replacementRange.location != NSNotFound && |
|
|
|
![self hasMarkedText] && |
|
|
|
parent->InputMethod->IsActive()) |
|
|
|
{ |
|
|
|
parent->InputMethod->Client->SelectInSurroundingText((int)replacementRange.location, (int)(replacementRange.location + replacementRange.length)); |
|
|
|
} |
|
|
|
|
|
|
|
[self unmarkText]; |
|
|
|
|
|
|
|
uint64_t timestamp = static_cast<uint64_t>([NSDate timeIntervalSinceReferenceDate] * 1000); |
|
|
|
|