Skip to content

Commit

Permalink
refine candidate_format
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed Feb 8, 2021
1 parent 61dc360 commit 58c8909
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions SquirrelPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 58c8909

Please sign in to comment.