Skip to content

Commit

Permalink
ctlInputMethod // Typo fix: condidate->candidate.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen committed Jun 28, 2022
1 parent 7ca5474 commit 38901c0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions SquirrelInputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -517,20 +517,20 @@ -(void)rimeUpdate
NSUInteger caretPos = utf8len(preedit, ctx.composition.cursor_pos);
NSRange selRange = NSMakeRange(start, end - start);
if (_inlineCandidate) {
const char *condidatePreview = ctx.commit_text_preview;
NSString *condidatePreviewText = condidatePreview ? @(condidatePreview) : @"";
const char *candidiatePreview = ctx.commit_text_preview;
NSString *candidiatePreviewText = candidiatePreview ? @(candidiatePreview) : @"";
if (_inlinePreedit) {
if ((caretPos >= NSMaxRange(selRange)) && (caretPos < preeditText.length)) {
condidatePreviewText = [condidatePreviewText stringByAppendingString:[preeditText substringWithRange:NSMakeRange(caretPos, preeditText.length-caretPos)]];
candidiatePreviewText = [candidiatePreviewText stringByAppendingString:[preeditText substringWithRange:NSMakeRange(caretPos, preeditText.length-caretPos)]];
}
[self showPreeditString:condidatePreviewText selRange:NSMakeRange(selRange.location, condidatePreviewText.length-selRange.location) caretPos:condidatePreviewText.length-(preeditText.length-caretPos)];
[self showPreeditString:candidiatePreviewText selRange:NSMakeRange(selRange.location, candidiatePreviewText.length-selRange.location) caretPos:candidiatePreviewText.length-(preeditText.length-caretPos)];
} else {
if ((NSMaxRange(selRange) < caretPos) && (caretPos > selRange.location)) {
condidatePreviewText = [condidatePreviewText substringWithRange:NSMakeRange(0, condidatePreviewText.length-(caretPos-NSMaxRange(selRange)))];
candidiatePreviewText = [candidiatePreviewText substringWithRange:NSMakeRange(0, candidiatePreviewText.length-(caretPos-NSMaxRange(selRange)))];
} else if ((NSMaxRange(selRange) < preeditText.length) && (caretPos <= selRange.location)) {
condidatePreviewText = [condidatePreviewText substringWithRange:NSMakeRange(0, condidatePreviewText.length-(preeditText.length-NSMaxRange(selRange)))];
candidiatePreviewText = [candidiatePreviewText substringWithRange:NSMakeRange(0, candidiatePreviewText.length-(preeditText.length-NSMaxRange(selRange)))];
}
[self showPreeditString:condidatePreviewText selRange:NSMakeRange(selRange.location, condidatePreviewText.length-selRange.location) caretPos:condidatePreviewText.length];
[self showPreeditString:candidiatePreviewText selRange:NSMakeRange(selRange.location, candidiatePreviewText.length-selRange.location) caretPos:candidiatePreviewText.length];
}
} else {
if (_inlinePreedit) {
Expand Down

0 comments on commit 38901c0

Please sign in to comment.