InputHandler // Extend Shift+Command+[] for candidate states.

This commit is contained in:
ShikiSuen 2023-02-14 17:20:19 +08:00
parent 97d2c94754
commit 5a96c264f3
3 changed files with 36 additions and 4 deletions

View File

@ -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 {

View File

@ -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)
}

View File

@ -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
}
}