diff --git a/SquirrelPanel.m b/SquirrelPanel.m index c4f3d4051..830613510 100644 --- a/SquirrelPanel.m +++ b/SquirrelPanel.m @@ -976,9 +976,6 @@ - (void)showPreedit:(NSString *)preedit labelRange2 = labelRange; labelFormat2 = labelFormat = nil; pureCandidateRange = [candidateFormat rangeOfString:@"%@"]; - if (pureCandidateRange.location == NSNotFound) { - pureCandidateRange = NSMakeRange(0, candidateFormat.length); - } } pureCandidateRange = [candidateFormat rangeOfString:@"%@"]; if (pureCandidateRange.location == NSNotFound) { @@ -993,8 +990,12 @@ - (void)showPreedit:(NSString *)preedit labelRange2 = NSMakeRange(NSNotFound, 0); labelFormat2 = nil; // fix label1, everything other than '%@' is label1 - labelRange.location = 0; - labelRange.length = pureCandidateRange.location; + if (pureCandidateRange.location > 0) { + labelRange.location = 0; + labelRange.length = pureCandidateRange.location; + } else { + labelRange = NSMakeRange(NSNotFound, 0); + } } else { if (pureCandidateRange.location > 0) { labelRange = NSMakeRange(0, pureCandidateRange.location); @@ -1143,7 +1144,7 @@ - (void)showPreedit:(NSString *)preedit if (i < comments.count && [comments[i] length] != 0) { [line appendAttributedString:[[NSAttributedString alloc] initWithString:@" " - attributes:attrs]]; + attributes:commentAttrs]]; NSString *comment = comments[i]; [line appendAttributedString:[[NSAttributedString alloc] initWithString:comment.precomposedStringWithCanonicalMapping