Also applies Chinese conversion on popped text.

Fixes issue #172.
This commit is contained in:
zonble 2021-11-19 22:59:12 +08:00 committed by Lukhnos Liu
parent a976e4c54a
commit c17d991718
1 changed files with 5 additions and 0 deletions

View File

@ -394,6 +394,7 @@ public:
return; return;
} }
// Chinese conversion.
NSString *buffer = _composingBuffer; NSString *buffer = _composingBuffer;
if (_chineseConversionEnabled) { if (_chineseConversionEnabled) {
buffer = [OpenCCBridge convert:_composingBuffer]; buffer = [OpenCCBridge convert:_composingBuffer];
@ -528,6 +529,10 @@ public:
if (_walkedNodes.size() > 0) { if (_walkedNodes.size() > 0) {
NodeAnchor &anchor = _walkedNodes[0]; NodeAnchor &anchor = _walkedNodes[0];
NSString *popedText = [NSString stringWithUTF8String:anchor.node->currentKeyValue().value.c_str()]; NSString *popedText = [NSString stringWithUTF8String:anchor.node->currentKeyValue().value.c_str()];
// Chinese conversion.
if (_chineseConversionEnabled) {
popedText = [OpenCCBridge convert:popedText];
}
[client insertText:popedText replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; [client insertText:popedText replacementRange:NSMakeRange(NSNotFound, NSNotFound)];
_builder->removeHeadReadings(anchor.spanningLength); _builder->removeHeadReadings(anchor.spanningLength);
} }