From 930071239f3385685af65fff7115082038c5d7d1 Mon Sep 17 00:00:00 2001 From: tisfeng Date: Mon, 22 Apr 2024 20:29:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20NSTextView=20render=20spaces=20incorrect?= =?UTF-8?q?ly=20if=20first=20char=20is=20an=20emoji,=20like=20=F0=9F=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Easydict/objc/Service/Model/EZError.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Easydict/objc/Service/Model/EZError.m b/Easydict/objc/Service/Model/EZError.m index 51d3daa95..da7318ad8 100644 --- a/Easydict/objc/Service/Model/EZError.m +++ b/Easydict/objc/Service/Model/EZError.m @@ -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]; }