From ee680297de99f2278163c36e7b31f0bc7cbd9119 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Mar 2022 11:14:36 +0800 Subject: [PATCH 01/14] (ctl)IME // Deprecating modifierFlags conditions. --- Source/Modules/IME.swift | 9 --------- .../Modules/IMEModules/ctlInputMethod.swift | 19 ------------------- 2 files changed, 28 deletions(-) diff --git a/Source/Modules/IME.swift b/Source/Modules/IME.swift index 5f898e26..8c56f79c 100644 --- a/Source/Modules/IME.swift +++ b/Source/Modules/IME.swift @@ -19,15 +19,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH import Cocoa @objc public class IME: NSObject { - // 直接在 AppleKeyboardConverter 內使用 KeyParser 判定修飾鍵狀態的話,會出現蛇吞自己尾巴的現象。 - // 所以就藉由 ctlInputMethod 的這幾個常態變數來判斷。 - // 這裡不會列出全部的 modifier flags,只會列出可能會影響符號輸入的 flags、主要用於 AppleKeyboardConverter。 - @objc static var isOptionPressed: Bool = false - @objc static var isShiftPressed: Bool = false - @objc static var isCapsLockOn: Bool = false - @objc static var isCommandPressed: Bool = false - @objc static var isNumericPad: Bool = false - @objc static var isFunction: Bool = false // MARK: - Functions diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift index fbb4d106..ca77e413 100644 --- a/Source/Modules/IMEModules/ctlInputMethod.swift +++ b/Source/Modules/IMEModules/ctlInputMethod.swift @@ -73,25 +73,6 @@ class ctlInputMethod: IMKInputController { client.overrideKeyboard(withKeyboardNamed: isfunctionKeyboardLayout ? mgrPrefs.functionKeyboardLayout : mgrPrefs.basisKeyboardLayout) } - func updateModifierFlags(_ event: NSEvent!) { - // 這裡不會列出全部的 modifier flags,只會列出可能會影響符號輸入的 flags、主要用於 AppleKeyboardConverter。 - IME.isShiftPressed = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.shift) - IME.isOptionPressed = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.option) - IME.isCapsLockOn = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.capsLock) - IME.isCommandPressed = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.command) - IME.isNumericPad = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.numericPad) - IME.isFunction = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.function) - } - - func resetModifierFlags() { - IME.isShiftPressed = false - IME.isOptionPressed = false - IME.isCapsLockOn = false - IME.isCommandPressed = false - IME.isNumericPad = false - IME.isFunction = false - } - // MARK: - IMKInputController methods override init!(server: IMKServer!, delegate: Any!, client inputClient: Any!) { From cd8de3fcb39cf91c72d4e1026a7d4d3b3cc4c34a Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Mar 2022 10:26:57 +0800 Subject: [PATCH 02/14] IME // Introducing ObjCUtils for keyLayout conditioning. --- Source/Headers/vChewing-Bridging-Header.h | 1 + Source/Modules/IMEModules/ObjCUtils.h | 18 ++++++++++++++++++ Source/Modules/IMEModules/ObjCUtils.m | 16 ++++++++++++++++ vChewing.xcodeproj/project.pbxproj | 6 ++++++ 4 files changed, 41 insertions(+) create mode 100644 Source/Modules/IMEModules/ObjCUtils.h create mode 100644 Source/Modules/IMEModules/ObjCUtils.m diff --git a/Source/Headers/vChewing-Bridging-Header.h b/Source/Headers/vChewing-Bridging-Header.h index d78ca431..bd2f463e 100644 --- a/Source/Headers/vChewing-Bridging-Header.h +++ b/Source/Headers/vChewing-Bridging-Header.h @@ -25,3 +25,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #import "KeyHandler.h" #import "mgrLangModel.h" +#import "ObjCUtils.h" diff --git a/Source/Modules/IMEModules/ObjCUtils.h b/Source/Modules/IMEModules/ObjCUtils.h new file mode 100644 index 00000000..35b39250 --- /dev/null +++ b/Source/Modules/IMEModules/ObjCUtils.h @@ -0,0 +1,18 @@ +// +// OjbCUtils.h +// vChewing +// +// Created by ShikiSuen on 2022/3/28. +// + +#import +#import +#import "vChewing-Swift.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ObjCUtils : NSObject ++ (bool)keyboardSwitchCondition:(NSEvent *)event; +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/Modules/IMEModules/ObjCUtils.m b/Source/Modules/IMEModules/ObjCUtils.m new file mode 100644 index 00000000..9563d026 --- /dev/null +++ b/Source/Modules/IMEModules/ObjCUtils.m @@ -0,0 +1,16 @@ +// +// OjbCUtils.m +// vChewing +// +// Created by ShikiSuen on 2022/3/28. +// + +#import "ObjCUtils.h" + +@implementation ObjCUtils + ++ (bool)keyboardSwitchCondition:(NSEvent *)event { + return ((event.modifierFlags & ~NSEventModifierFlagShift) || ((event.modifierFlags & NSEventModifierFlagShift) && mgrPrefs.functionKeyKeyboardLayoutOverrideIncludeShiftKey)); +} + +@end diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index 59bdecf3..e1949c2c 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -41,6 +41,7 @@ 5BBBB77627AED70B0023B93A /* MenuIcon-TCVIM.png in Resources */ = {isa = PBXBuildFile; fileRef = 5BBBB77227AED70B0023B93A /* MenuIcon-TCVIM.png */; }; 5BBBB77A27AEDC690023B93A /* clsSFX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBBB77927AEDC690023B93A /* clsSFX.swift */; }; 5BC2652227E04B7E00700291 /* uninstall.sh in Resources */ = {isa = PBXBuildFile; fileRef = 5BC2652127E04B7B00700291 /* uninstall.sh */; }; + 5BCD76CF27F1484D00C41430 /* ObjCUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BCD76CE27F1484D00C41430 /* ObjCUtils.m */; }; 5BD05B8127B22F3C004C4F1D /* char-kanji-cns.txt in Resources */ = {isa = PBXBuildFile; fileRef = 5BD05B8027B22F3C004C4F1D /* char-kanji-cns.txt */; }; 5BD05BCA27B2A43D004C4F1D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6A2E40F5253A69DA00D1AE1D /* Images.xcassets */; }; 5BD05C5D27B2BBA9004C4F1D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5BD05C5B27B2BBA9004C4F1D /* Main.storyboard */; }; @@ -199,6 +200,8 @@ 5BBBB77927AEDC690023B93A /* clsSFX.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = clsSFX.swift; sourceTree = ""; }; 5BBD627827B6C4D900271480 /* Update-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Update-Info.plist"; sourceTree = ""; }; 5BC2652127E04B7B00700291 /* uninstall.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; lineEnding = 0; path = uninstall.sh; sourceTree = ""; }; + 5BCD76CD27F1484D00C41430 /* ObjCUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ObjCUtils.h; path = Source/Modules/IMEModules/ObjCUtils.h; sourceTree = SOURCE_ROOT; }; + 5BCD76CE27F1484D00C41430 /* ObjCUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ObjCUtils.m; path = Source/Modules/IMEModules/ObjCUtils.m; sourceTree = SOURCE_ROOT; }; 5BD05B8027B22F3C004C4F1D /* char-kanji-cns.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "char-kanji-cns.txt"; path = "Data/components/common/char-kanji-cns.txt"; sourceTree = ""; }; 5BD05BB827B2A429004C4F1D /* vChewingPhraseEditor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vChewingPhraseEditor.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5BD05BC627B2A42A004C4F1D /* vChewingPhraseEditor.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = vChewingPhraseEditor.entitlements; sourceTree = ""; }; @@ -409,6 +412,8 @@ D4A13D5927A59D5C003BE359 /* ctlInputMethod.swift */, 5B62A33127AE792F00A19448 /* InputSourceHelper.swift */, 5B62A33527AE795800A19448 /* mgrPrefs.swift */, + 5BCD76CD27F1484D00C41430 /* ObjCUtils.h */, + 5BCD76CE27F1484D00C41430 /* ObjCUtils.m */, ); path = IMEModules; sourceTree = ""; @@ -971,6 +976,7 @@ D47D73AC27A6CAE600255A50 /* AssociatedPhrases.mm in Sources */, 5B62A34A27AE7CD900A19448 /* NotifierController.swift in Sources */, 5B11328927B94CFB00E58451 /* AppleKeyboardConverter.swift in Sources */, + 5BCD76CF27F1484D00C41430 /* ObjCUtils.m in Sources */, D41355DB278E6D17005E5CBD /* LMInstantiator.mm in Sources */, 5B62A32927AE77D100A19448 /* FSEventStreamHelper.swift in Sources */, D47F7DD3278C1263002F9DD7 /* UserOverrideModel.cpp in Sources */, From f3c46a2810b1303d3873ab646f0ceb2d842e9de2 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Mar 2022 10:29:55 +0800 Subject: [PATCH 03/14] ctlIME // Restore keyLayout behavior to McBopomofo 2.0. - Swift cannot handle the keyLayout condition. Use ObjC. --- .../Modules/IMEModules/ctlInputMethod.swift | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift index ca77e413..4cf53659 100644 --- a/Source/Modules/IMEModules/ctlInputMethod.swift +++ b/Source/Modules/IMEModules/ctlInputMethod.swift @@ -63,11 +63,6 @@ class ctlInputMethod: IMKInputController { // MARK: - Keyboard Layout Specifier - func getKeyLayoutFlagsCondition(_ event: NSEvent!) -> Bool { - event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(NSEvent.ModifierFlags(rawValue: ~(NSEvent.ModifierFlags.shift.rawValue))) || - (event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.shift) && mgrPrefs.functionKeyKeyboardLayoutOverrideIncludeShiftKey) - } - @objc func setKeyLayout(isfunctionKeyboardLayout: Bool = false) { let client = client().self as IMKTextInput client.overrideKeyboard(withKeyboardNamed: isfunctionKeyboardLayout ? mgrPrefs.functionKeyboardLayout : mgrPrefs.basisKeyboardLayout) @@ -157,7 +152,7 @@ class ctlInputMethod: IMKInputController { UserDefaults.standard.synchronize() // Override the keyboard layout to the basic one. - setKeyLayout(isfunctionKeyboardLayout: false) + (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout) // reset the state currentCandidateClient = nil @@ -186,7 +181,7 @@ class ctlInputMethod: IMKInputController { mgrLangModel.loadDataModel(newInputMode) // Remember to override the keyboard layout again -- treat this as an activate event. - setKeyLayout(isfunctionKeyboardLayout: false) + (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout) if keyHandler.inputMode != newInputMode { UserDefaults.standard.synchronize() @@ -207,19 +202,27 @@ class ctlInputMethod: IMKInputController { } override func handle(_ event: NSEvent!, client: Any!) -> Bool { - //重設且更新全局共用狀態開關的參數。 - resetModifierFlags() - updateModifierFlags(event) - if mgrPrefs.functionKeyboardLayout != mgrPrefs.basisKeyboardLayout { - // 這裡仍舊需要判斷 flags。之前使輸入法狀態卡住無法敲漢字的問題已在 KeyHandler 內修復。 - // 這裡不判斷 flags 的話,用方向鍵前後定位光標之後,再次試圖觸發組字區時、反而會在首次按鍵時失敗。 - // 同時注意:必須在 event.type == .flagsChanged 結尾插入 return false, - // 否則,每次處理這種判斷時都會觸發 NSInternalInconsistencyException。 - if event.type == .flagsChanged { - setKeyLayout(isfunctionKeyboardLayout: getKeyLayoutFlagsCondition(event)) + // 這裡仍舊需要判斷 flags。之前使輸入法狀態卡住無法敲漢字的問題已在 KeyHandler 內修復。 + // 這裡不判斷 flags 的話,用方向鍵前後定位光標之後,再次試圖觸發組字區時、反而會在首次按鍵時失敗。 + // 同時注意:必須在 event.type == .flagsChanged 結尾插入 return false, + // 否則,每次處理這種判斷時都會觸發 NSInternalInconsistencyException。 + if event.type == .flagsChanged { + // If no override is needed, just return NO. + if mgrPrefs.functionKeyboardLayout == mgrPrefs.basisKeyboardLayout { return false } + + // Function key conditions met. Swift cannot handle this. + if ObjCUtils.keyboardSwitchCondition(event) { + setKeyLayout(isfunctionKeyboardLayout: true) + (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.functionKeyboardLayout) + return false + } + + // Revert to the basis layout when the function key is released. This step has to be standalone. + (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout) + return false } // 準備修飾鍵,用來判定是否需要利用就地新增語彙時的 Enter 鍵來砍詞。 From f0dc85f1a3e8ae50b15e9f81e36ce6e7968d4f8a Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Mar 2022 11:10:03 +0800 Subject: [PATCH 04/14] ctlIME // Sacrificing advanced keyLayout feature. - It is now impossible to ensure the reliability of this feature. --- .../Modules/IMEModules/ctlInputMethod.swift | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift index 4cf53659..0929f25f 100644 --- a/Source/Modules/IMEModules/ctlInputMethod.swift +++ b/Source/Modules/IMEModules/ctlInputMethod.swift @@ -63,9 +63,9 @@ class ctlInputMethod: IMKInputController { // MARK: - Keyboard Layout Specifier - @objc func setKeyLayout(isfunctionKeyboardLayout: Bool = false) { + @objc func setKeyLayout() { let client = client().self as IMKTextInput - client.overrideKeyboard(withKeyboardNamed: isfunctionKeyboardLayout ? mgrPrefs.functionKeyboardLayout : mgrPrefs.basisKeyboardLayout) + client.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout) } // MARK: - IMKInputController methods @@ -142,7 +142,7 @@ class ctlInputMethod: IMKInputController { } // NSMenu 會阻止任何 modified key 相關的訊號傳回輸入法,所以咱們在此重設鍵盤佈局 - setKeyLayout(isfunctionKeyboardLayout: false) + setKeyLayout() return menu } @@ -152,7 +152,7 @@ class ctlInputMethod: IMKInputController { UserDefaults.standard.synchronize() // Override the keyboard layout to the basic one. - (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout) + setKeyLayout() // reset the state currentCandidateClient = nil @@ -181,7 +181,7 @@ class ctlInputMethod: IMKInputController { mgrLangModel.loadDataModel(newInputMode) // Remember to override the keyboard layout again -- treat this as an activate event. - (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout) + setKeyLayout() if keyHandler.inputMode != newInputMode { UserDefaults.standard.synchronize() @@ -208,20 +208,6 @@ class ctlInputMethod: IMKInputController { // 同時注意:必須在 event.type == .flagsChanged 結尾插入 return false, // 否則,每次處理這種判斷時都會觸發 NSInternalInconsistencyException。 if event.type == .flagsChanged { - // If no override is needed, just return NO. - if mgrPrefs.functionKeyboardLayout == mgrPrefs.basisKeyboardLayout { - return false - } - - // Function key conditions met. Swift cannot handle this. - if ObjCUtils.keyboardSwitchCondition(event) { - setKeyLayout(isfunctionKeyboardLayout: true) - (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.functionKeyboardLayout) - return false - } - - // Revert to the basis layout when the function key is released. This step has to be standalone. - (client as? IMKTextInput)?.overrideKeyboard(withKeyboardNamed: mgrPrefs.basisKeyboardLayout) return false } From abba6d993e6ba7be95ac1eca2aa3d44bccba6b58 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Mar 2022 12:55:45 +0800 Subject: [PATCH 05/14] mgrPref // Cleanup, sacrificing advanced keyLayout feature. --- Source/Modules/IMEModules/mgrPrefs.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Source/Modules/IMEModules/mgrPrefs.swift b/Source/Modules/IMEModules/mgrPrefs.swift index 817f7815..4a5c6be3 100644 --- a/Source/Modules/IMEModules/mgrPrefs.swift +++ b/Source/Modules/IMEModules/mgrPrefs.swift @@ -23,8 +23,6 @@ private let kIsDebugModeEnabled = "_DebugMode" private let kCheckUpdateAutomatically = "CheckUpdateAutomatically" private let kKeyboardLayoutPreference = "KeyboardLayout" private let kBasisKeyboardLayoutPreference = "BasisKeyboardLayout" -private let kFunctionKeyKeyboardLayoutPreference = "FunctionKeyKeyboardLayout" -private let kFunctionKeyKeyboardLayoutOverrideIncludeShift = "FunctionKeyKeyboardLayoutOverrideIncludeShift" private let kShowPageButtonsInCandidateWindow = "ShowPageButtonsInCandidateWindow" private let kCandidateListTextSize = "CandidateListTextSize" private let kAppleLanguagesPreferences = "AppleLanguages" @@ -217,8 +215,6 @@ struct ComposingBufferSize { [kIsDebugModeEnabled, kKeyboardLayoutPreference, kBasisKeyboardLayoutPreference, - kFunctionKeyKeyboardLayoutPreference, - kFunctionKeyKeyboardLayoutOverrideIncludeShift, kShowPageButtonsInCandidateWindow, kCandidateListTextSize, kAppleLanguagesPreferences, @@ -365,12 +361,6 @@ struct ComposingBufferSize { @UserDefault(key: kBasisKeyboardLayoutPreference, defaultValue: "com.apple.keylayout.ZhuyinBopomofo") @objc static var basisKeyboardLayout: String - @UserDefault(key: kFunctionKeyKeyboardLayoutPreference, defaultValue: "com.apple.keylayout.ABC") - @objc static var functionKeyboardLayout: String - - @UserDefault(key: kFunctionKeyKeyboardLayoutOverrideIncludeShift, defaultValue: false) - @objc static var functionKeyKeyboardLayoutOverrideIncludeShiftKey: Bool - @UserDefault(key: kShowPageButtonsInCandidateWindow, defaultValue: true) @objc static var showPageButtonsInCandidateWindow: Bool From 7f8546325bd409b22bb55e00ad12540ce74beb9f Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Mar 2022 11:16:47 +0800 Subject: [PATCH 06/14] IME // Deprecating ObjCUtils. --- Source/Headers/vChewing-Bridging-Header.h | 1 - Source/Modules/IMEModules/ObjCUtils.h | 18 ------------------ Source/Modules/IMEModules/ObjCUtils.m | 16 ---------------- vChewing.xcodeproj/project.pbxproj | 6 ------ 4 files changed, 41 deletions(-) delete mode 100644 Source/Modules/IMEModules/ObjCUtils.h delete mode 100644 Source/Modules/IMEModules/ObjCUtils.m diff --git a/Source/Headers/vChewing-Bridging-Header.h b/Source/Headers/vChewing-Bridging-Header.h index bd2f463e..d78ca431 100644 --- a/Source/Headers/vChewing-Bridging-Header.h +++ b/Source/Headers/vChewing-Bridging-Header.h @@ -25,4 +25,3 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #import "KeyHandler.h" #import "mgrLangModel.h" -#import "ObjCUtils.h" diff --git a/Source/Modules/IMEModules/ObjCUtils.h b/Source/Modules/IMEModules/ObjCUtils.h deleted file mode 100644 index 35b39250..00000000 --- a/Source/Modules/IMEModules/ObjCUtils.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// OjbCUtils.h -// vChewing -// -// Created by ShikiSuen on 2022/3/28. -// - -#import -#import -#import "vChewing-Swift.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ObjCUtils : NSObject -+ (bool)keyboardSwitchCondition:(NSEvent *)event; -@end - -NS_ASSUME_NONNULL_END diff --git a/Source/Modules/IMEModules/ObjCUtils.m b/Source/Modules/IMEModules/ObjCUtils.m deleted file mode 100644 index 9563d026..00000000 --- a/Source/Modules/IMEModules/ObjCUtils.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// OjbCUtils.m -// vChewing -// -// Created by ShikiSuen on 2022/3/28. -// - -#import "ObjCUtils.h" - -@implementation ObjCUtils - -+ (bool)keyboardSwitchCondition:(NSEvent *)event { - return ((event.modifierFlags & ~NSEventModifierFlagShift) || ((event.modifierFlags & NSEventModifierFlagShift) && mgrPrefs.functionKeyKeyboardLayoutOverrideIncludeShiftKey)); -} - -@end diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index e1949c2c..59bdecf3 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -41,7 +41,6 @@ 5BBBB77627AED70B0023B93A /* MenuIcon-TCVIM.png in Resources */ = {isa = PBXBuildFile; fileRef = 5BBBB77227AED70B0023B93A /* MenuIcon-TCVIM.png */; }; 5BBBB77A27AEDC690023B93A /* clsSFX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBBB77927AEDC690023B93A /* clsSFX.swift */; }; 5BC2652227E04B7E00700291 /* uninstall.sh in Resources */ = {isa = PBXBuildFile; fileRef = 5BC2652127E04B7B00700291 /* uninstall.sh */; }; - 5BCD76CF27F1484D00C41430 /* ObjCUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BCD76CE27F1484D00C41430 /* ObjCUtils.m */; }; 5BD05B8127B22F3C004C4F1D /* char-kanji-cns.txt in Resources */ = {isa = PBXBuildFile; fileRef = 5BD05B8027B22F3C004C4F1D /* char-kanji-cns.txt */; }; 5BD05BCA27B2A43D004C4F1D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6A2E40F5253A69DA00D1AE1D /* Images.xcassets */; }; 5BD05C5D27B2BBA9004C4F1D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5BD05C5B27B2BBA9004C4F1D /* Main.storyboard */; }; @@ -200,8 +199,6 @@ 5BBBB77927AEDC690023B93A /* clsSFX.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = clsSFX.swift; sourceTree = ""; }; 5BBD627827B6C4D900271480 /* Update-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Update-Info.plist"; sourceTree = ""; }; 5BC2652127E04B7B00700291 /* uninstall.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; lineEnding = 0; path = uninstall.sh; sourceTree = ""; }; - 5BCD76CD27F1484D00C41430 /* ObjCUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ObjCUtils.h; path = Source/Modules/IMEModules/ObjCUtils.h; sourceTree = SOURCE_ROOT; }; - 5BCD76CE27F1484D00C41430 /* ObjCUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ObjCUtils.m; path = Source/Modules/IMEModules/ObjCUtils.m; sourceTree = SOURCE_ROOT; }; 5BD05B8027B22F3C004C4F1D /* char-kanji-cns.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "char-kanji-cns.txt"; path = "Data/components/common/char-kanji-cns.txt"; sourceTree = ""; }; 5BD05BB827B2A429004C4F1D /* vChewingPhraseEditor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vChewingPhraseEditor.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5BD05BC627B2A42A004C4F1D /* vChewingPhraseEditor.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = vChewingPhraseEditor.entitlements; sourceTree = ""; }; @@ -412,8 +409,6 @@ D4A13D5927A59D5C003BE359 /* ctlInputMethod.swift */, 5B62A33127AE792F00A19448 /* InputSourceHelper.swift */, 5B62A33527AE795800A19448 /* mgrPrefs.swift */, - 5BCD76CD27F1484D00C41430 /* ObjCUtils.h */, - 5BCD76CE27F1484D00C41430 /* ObjCUtils.m */, ); path = IMEModules; sourceTree = ""; @@ -976,7 +971,6 @@ D47D73AC27A6CAE600255A50 /* AssociatedPhrases.mm in Sources */, 5B62A34A27AE7CD900A19448 /* NotifierController.swift in Sources */, 5B11328927B94CFB00E58451 /* AppleKeyboardConverter.swift in Sources */, - 5BCD76CF27F1484D00C41430 /* ObjCUtils.m in Sources */, D41355DB278E6D17005E5CBD /* LMInstantiator.mm in Sources */, 5B62A32927AE77D100A19448 /* FSEventStreamHelper.swift in Sources */, D47F7DD3278C1263002F9DD7 /* UserOverrideModel.cpp in Sources */, From 27ccbed9fa653a474be3ced78c29287ccb1ea061 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Mar 2022 17:39:53 +0800 Subject: [PATCH 07/14] KeyHandler // Allow cursor pushing regardless cursor modes. - Plus related Japanese localization fix. --- .../Modules/ControllerModules/KeyHandler.mm | 3 +- .../WindowNIBs/Base.lproj/frmPrefWindow.xib | 53 +++++++++---------- .../WindowNIBs/ja.lproj/frmPrefWindow.strings | 2 +- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/Source/Modules/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm index 5414dd3c..56dd029c 100644 --- a/Source/Modules/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -231,8 +231,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; } [self _walk]; - if (mgrPrefs.selectPhraseAfterCursorAsCandidate && - mgrPrefs.moveCursorAfterSelectingCandidate) { + if (mgrPrefs.moveCursorAfterSelectingCandidate) { size_t nextPosition = 0; for (auto node: _walkedNodes) { if (nextPosition >= cursorIndex) { diff --git a/Source/WindowNIBs/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib b/Source/WindowNIBs/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib index 4fc4b409..5cf4fda9 100644 --- a/Source/WindowNIBs/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib +++ b/Source/WindowNIBs/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib @@ -19,6 +19,7 @@ + @@ -161,7 +162,7 @@ - + @@ -448,7 +448,7 @@ - + @@ -456,7 +456,7 @@ - + @@ -481,7 +481,7 @@ - + @@ -489,7 +489,7 @@