diff --git a/Source/Modules/InputHandler_HandleCandidate.swift b/Source/Modules/InputHandler_HandleCandidate.swift index 858daf50..65005013 100644 --- a/Source/Modules/InputHandler_HandleCandidate.swift +++ b/Source/Modules/InputHandler_HandleCandidate.swift @@ -195,6 +195,24 @@ extension InputHandler { } } + // MARK: - Flipping pages by using modified bracket keys (when they are not occupied). + + // Shift+Command+[] 被 Chrome 系瀏覽器佔用,所以改用 Ctrl。 + revolveCandidateWithBrackets: if input.modifierFlags == [.control, .command] { + if !state.isCandidateContainer { break revolveCandidateWithBrackets } + // 此處 JIS 鍵盤判定無法用於螢幕鍵盤。所以,螢幕鍵盤的場合,系統會依照 US 鍵盤的判定方案。 + let isJIS: Bool = KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardJIS + switch (input.keyCode, isJIS) { + case (30, true), (33, false): + _ = ctlCandidate.highlightPreviousCandidate() ? {}() : delegate.callError("8B144DCD") + return true + case (42, true), (30, false): + _ = ctlCandidate.highlightNextCandidate() ? {}() : delegate.callError("D2ABB507") + return true + default: break + } + } + // MARK: - Flipping pages by using symbol menu keys (when they are not occupied). if input.isSymbolMenuPhysicalKey { diff --git a/Source/Modules/InputHandler_HandleEvent.swift b/Source/Modules/InputHandler_HandleEvent.swift index 5a44ac5b..ce08ad7f 100644 --- a/Source/Modules/InputHandler_HandleEvent.swift +++ b/Source/Modules/InputHandler_HandleEvent.swift @@ -128,6 +128,22 @@ extension InputHandler { } } + // Shift+Command+[] 被 Chrome 系瀏覽器佔用,所以改用 Ctrl。 + revolveCandidateWithBrackets: if event.modifierFlags == [.control, .command] { + if !delegate.state.isCandidateContainer { break revolveCandidateWithBrackets } + // 此處 JIS 鍵盤判定無法用於螢幕鍵盤。所以,螢幕鍵盤的場合,系統會依照 US 鍵盤的判定方案。 + let isJIS: Bool = KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardJIS + switch (event.keyCode, isJIS) { + case (30, true), (33, false): + _ = imkC.highlightPreviousCandidate() ? {}() : delegate.callError("8B144DCD") + return true + case (42, true), (30, false): + _ = imkC.highlightNextCandidate() ? {}() : delegate.callError("D2ABB507") + return true + default: break + } + } + if prefs.useSCPCTypingMode, !event.isReservedKey { return handleInput(event: event) } diff --git a/Source/Modules/InputHandler_HandleInput.swift b/Source/Modules/InputHandler_HandleInput.swift index c7a8bf61..0945dbc8 100644 --- a/Source/Modules/InputHandler_HandleInput.swift +++ b/Source/Modules/InputHandler_HandleInput.swift @@ -140,10 +140,8 @@ extension InputHandler { // 此處 JIS 鍵盤判定無法用於螢幕鍵盤。所以,螢幕鍵盤的場合,系統會依照 US 鍵盤的判定方案。 let isJIS: Bool = KBGetLayoutType(Int16(LMGetKbdType())) == kKeyboardJIS switch (input.keyCode, isJIS) { - case (30, true): return revolveCandidate(reverseOrder: true) - case (42, true): return revolveCandidate(reverseOrder: false) - case (33, false): return revolveCandidate(reverseOrder: true) - case (30, false): return revolveCandidate(reverseOrder: false) + case (30, true), (33, false): return revolveCandidate(reverseOrder: true) + case (42, true), (30, false): return revolveCandidate(reverseOrder: false) default: break } }