diff --git a/Source/Modules/ControllerModules/InputSignal.swift b/Source/Modules/ControllerModules/InputSignal.swift index 4bf8309a..ab6fa017 100644 --- a/Source/Modules/ControllerModules/InputSignal.swift +++ b/Source/Modules/ControllerModules/InputSignal.swift @@ -34,7 +34,7 @@ enum KeyCode: UInt16 { case kCarriageReturn = 36 // Renamed from "kReturn" to avoid nomenclatural confusions. case kTab = 48 case kSpace = 49 - case kSymbolMenuPhysicalKey = 50 // vChewing Specific + case kSymbolMenuPhysicalKeyIntl = 50 // vChewing Specific (Non-JIS) case kBackSpace = 51 // Renamed from "kDelete" to avoid nomenclatural confusions. case kEscape = 53 case kCommand = 55 @@ -54,6 +54,7 @@ enum KeyCode: UInt16 { case kF18 = 79 case kF19 = 80 case kF20 = 90 + case kSymbolMenuPhysicalKeyJIS = 94 // vChewing Specific (JIS) case kF5 = 96 case kF6 = 97 case kF7 = 98 @@ -344,7 +345,7 @@ struct InputSignal: CustomStringConvertible { var isSymbolMenuPhysicalKey: Bool { // 這裡必須用 KeyCode,這樣才不會受隨 macOS 版本更動的 Apple 動態注音鍵盤排列內容的影響。 // 只是必須得與 ![input isShift] 搭配使用才可以(也就是僅判定 Shift 沒被摁下的情形)。 - KeyCode(rawValue: keyCode) == KeyCode.kSymbolMenuPhysicalKey + [KeyCode.kSymbolMenuPhysicalKeyIntl, KeyCode.kSymbolMenuPhysicalKeyJIS].contains(KeyCode(rawValue: keyCode)) } } diff --git a/vChewingTests/KeyHandlerTestsNormalCHS.swift b/vChewingTests/KeyHandlerTestsNormalCHS.swift index 15e48e11..c6e14668 100644 --- a/vChewingTests/KeyHandlerTestsNormalCHS.swift +++ b/vChewingTests/KeyHandlerTestsNormalCHS.swift @@ -337,7 +337,7 @@ class KeyHandlerTestsNormalCHS: XCTestCase { let enabled = mgrPrefs.halfWidthPunctuationEnabled mgrPrefs.halfWidthPunctuationEnabled = false let input = InputSignal( - inputText: " ", keyCode: KeyCode.kSymbolMenuPhysicalKey.rawValue, charCode: 0, flags: [], + inputText: " ", keyCode: KeyCode.kSymbolMenuPhysicalKeyIntl.rawValue, charCode: 0, flags: [], isVerticalTyping: false ) var state: InputStateProtocol = InputState.Empty() @@ -354,7 +354,7 @@ class KeyHandlerTestsNormalCHS: XCTestCase { let enabled = mgrPrefs.halfWidthPunctuationEnabled mgrPrefs.halfWidthPunctuationEnabled = false let input = InputSignal( - inputText: " ", keyCode: KeyCode.kSymbolMenuPhysicalKey.rawValue, charCode: 0, flags: .option, + inputText: " ", keyCode: KeyCode.kSymbolMenuPhysicalKeyIntl.rawValue, charCode: 0, flags: .option, isVerticalTyping: false ) var state: InputStateProtocol = InputState.Empty() diff --git a/vChewingTests/KeyHandlerTestsSCPCCHT.swift b/vChewingTests/KeyHandlerTestsSCPCCHT.swift index 5753ccd2..edcdbcbc 100644 --- a/vChewingTests/KeyHandlerTestsSCPCCHT.swift +++ b/vChewingTests/KeyHandlerTestsSCPCCHT.swift @@ -75,7 +75,7 @@ class KeyHandlerTestsSCPCCHT: XCTestCase { func testPunctuationTable() { let input = InputSignal( - inputText: "`", keyCode: KeyCode.kSymbolMenuPhysicalKey.rawValue, charCode: 0, flags: .option + inputText: "`", keyCode: KeyCode.kSymbolMenuPhysicalKeyIntl.rawValue, charCode: 0, flags: .option ) var state: InputStateProtocol = InputState.Empty() _ = handler.handle(input: input, state: state) { newState in