Skip to content

Commit

Permalink
fix: NSTextView render spaces incorrectly if first char is an emoji, …
Browse files Browse the repository at this point in the history
…like 💥
  • Loading branch information
tisfeng committed Apr 22, 2024
1 parent 7a76a36 commit 9300712
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Easydict/objc/Service/Model/EZError.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ + (instancetype)errorWithType:(EZErrorType)type
}

NSString *queryFailedString = NSLocalizedString(@"query_failed", nil);
/**
FIXME: If the first character of the text is an emoji, like "💥 失败", NSTextView will render spaces incorrectly.
I don't know how to fix it, so I'm inserting an invisible special character at the beginning.
*/
NSString *zeroWidthSpace = @"\u200B";
queryFailedString = [zeroWidthSpace stringByAppendingString:queryFailedString];

if (errorString.length) {
errorString = [NSString stringWithFormat:@"%@, %@", queryFailedString, errorString];
}
Expand Down

0 comments on commit 9300712

Please sign in to comment.