From fd2074b44e2d6bd52044b6f6865aba9c978d448a Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 21 Apr 2022 12:42:45 +0800 Subject: [PATCH] KeyHandler // Tweak the tooltip of buildInputtingState(). - I can't figure out the meaning of "before and after" in this context, hence the necessity of simplifying the processing model here. Plus, this tooltip won't be presented to the end user anymore since this IME already has NSStringUtils for handling Emojis well. --- Source/Modules/ControllerModules/KeyHandler.mm | 8 ++++---- .../Modules/ControllerModules/KeyHandler_States.swift | 11 +++-------- Source/Resources/Base.lproj/Localizable.strings | 2 -- Source/Resources/en.lproj/Localizable.strings | 2 -- Source/Resources/ja.lproj/Localizable.strings | 2 -- Source/Resources/zh-Hans.lproj/Localizable.strings | 2 -- Source/Resources/zh-Hant.lproj/Localizable.strings | 2 -- 7 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Source/Modules/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm index 701d763e..c9be6c67 100644 --- a/Source/Modules/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -282,19 +282,19 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; } if (builderCursorIndex == 0) { - resultOfRear = + resultOfFront = [NSString stringWithUTF8String:_builder->readings()[builderCursorIndex].c_str()]; } else if (builderCursorIndex >= _builder->readings().size()) { - resultOfFront = [NSString + resultOfRear = [NSString stringWithUTF8String:_builder->readings()[_builder->readings().size() - 1].c_str()]; } else { - resultOfRear = - [NSString stringWithUTF8String:_builder->readings()[builderCursorIndex].c_str()]; resultOfFront = + [NSString stringWithUTF8String:_builder->readings()[builderCursorIndex].c_str()]; + resultOfRear = [NSString stringWithUTF8String:_builder->readings()[builderCursorIndex - 1].c_str()]; } } diff --git a/Source/Modules/ControllerModules/KeyHandler_States.swift b/Source/Modules/ControllerModules/KeyHandler_States.swift index ecdf9b0a..a19dc440 100644 --- a/Source/Modules/ControllerModules/KeyHandler_States.swift +++ b/Source/Modules/ControllerModules/KeyHandler_States.swift @@ -45,20 +45,15 @@ import Cocoa // 組建提示文本 var tooltip = "" - if resultOfRear == "", resultOfFront != "" { - tooltip = String(format: NSLocalizedString("Cursor is in front of \"%@\".", comment: ""), resultOfFront) - } - if resultOfRear != "", resultOfFront == "" { - tooltip = String(format: NSLocalizedString("Cursor is at the rear of \"%@\".", comment: ""), resultOfRear) - } - if resultOfRear != "", resultOfFront != "" { + // 備註:因為目前的輸入法已經有了 NSString Emoji 支援,所以這個工具提示可能不會出現了。 + // 姑且留下來用作萬一時的偵錯用途。 + if resultOfRear != "" || resultOfFront != "" { tooltip = String( format: NSLocalizedString("Cursor is between \"%@\" and \"%@\".", comment: ""), resultOfFront, resultOfRear ) } - // 給新狀態安插配置好的提示文本、且送出新狀態 newState.tooltip = tooltip return newState } diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index 68b518dd..d4acd329 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -56,8 +56,6 @@ "Symbol & Emoji Input" = "Symbol & Emoji Input"; "Edit User Symbol & Emoji Data…" = "Edit User Symbol & Emoji Data…"; "Choose your desired user data folder." = "Choose your desired user data folder."; -"Cursor is in front of \"%@\"." = "Cursor is in front of \"%@\"."; -"Cursor is at the rear of \"%@\"." = "Cursor is at the rear of \"%@\"."; "Cursor is between \"%@\" and \"%@\"." = "Cursor is between \"%@\" and \"%@\"."; // The followings are the category names used in the Symbol menu. diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index 68b518dd..d4acd329 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -56,8 +56,6 @@ "Symbol & Emoji Input" = "Symbol & Emoji Input"; "Edit User Symbol & Emoji Data…" = "Edit User Symbol & Emoji Data…"; "Choose your desired user data folder." = "Choose your desired user data folder."; -"Cursor is in front of \"%@\"." = "Cursor is in front of \"%@\"."; -"Cursor is at the rear of \"%@\"." = "Cursor is at the rear of \"%@\"."; "Cursor is between \"%@\" and \"%@\"." = "Cursor is between \"%@\" and \"%@\"."; // The followings are the category names used in the Symbol menu. diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 18b4d7ea..b9a43b81 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -56,8 +56,6 @@ "Symbol & Emoji Input" = "符号&絵文字入力"; "Edit User Symbol & Emoji Data…" = "ユーザー符号&絵文字辞書を編集…"; "Choose your desired user data folder." = "欲しがるユーザー辞書フォルダをお選びください。"; -"Cursor is in front of \"%@\"." = "カーソルは「%@」の後に。"; -"Cursor is at the rear of \"%@\"." = "カーソル「%@」の前に。"; "Cursor is between \"%@\" and \"%@\"." = "カーソルは「%@」と「%@」に間れ。"; // The followings are the category names used in the Symbol menu. diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index a6e56b70..9e4106b0 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -56,8 +56,6 @@ "Symbol & Emoji Input" = "符号&绘文字输入"; "Edit User Symbol & Emoji Data…" = "编辑自订符号&绘文字资料…"; "Choose your desired user data folder." = "请选择您想指定的使用者语汇档案目录。"; -"Cursor is in front of \"%@\"." = "游标在「%@」之后。"; -"Cursor is at the rear of \"%@\"." = "游标在「%@」之前。"; "Cursor is between \"%@\" and \"%@\"." = "游标介于「%@」与「%@」之间。"; // The followings are the category names used in the Symbol menu. diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 2e9d83a7..af198887 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -56,8 +56,6 @@ "Symbol & Emoji Input" = "符號&繪文字輸入"; "Edit User Symbol & Emoji Data…" = "編輯自訂符號&繪文字資料…"; "Choose your desired user data folder." = "請選擇您想指定的使用者語彙檔案目錄。"; -"Cursor is in front of \"%@\"." = "游標在「%@」之後。"; -"Cursor is at the rear of \"%@\"." = "游標在「%@」之前。"; "Cursor is between \"%@\" and \"%@\"." = "游標介於「%@」與「%@」之間。"; // The followings are the category names used in the Symbol menu.