KeyHandler // +upperCaseLetterKeyBehavior.
This commit is contained in:
parent
aeed63a20a
commit
58a68c51fc
|
@ -359,20 +359,6 @@ extension KeyHandler {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 這裡不使用小麥注音 2.2 版的組字區處理方式,而是直接由詞庫負責。
|
|
||||||
if input.isUpperCaseASCIILetterKey {
|
|
||||||
let letter: String! = String(format: "%@%c", "_letter_", charCode.isPrintableASCII ? CChar(charCode) : inputText)
|
|
||||||
if handlePunctuation(
|
|
||||||
letter,
|
|
||||||
state: state,
|
|
||||||
usingVerticalTyping: input.isTypingVertical,
|
|
||||||
stateCallback: stateCallback,
|
|
||||||
errorCallback: errorCallback
|
|
||||||
) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: 全形/半形空白 (Full-Width / Half-Width Space)
|
// MARK: 全形/半形空白 (Full-Width / Half-Width Space)
|
||||||
|
|
||||||
/// 該功能僅可在當前組字區沒有任何內容的時候使用。
|
/// 該功能僅可在當前組字區沒有任何內容的時候使用。
|
||||||
|
@ -384,6 +370,38 @@ extension KeyHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: 摁住 Shift+字母鍵 的處理 (Shift+Letter Processing)
|
||||||
|
|
||||||
|
// 這裡不使用小麥注音 2.2 版的組字區處理方式,而是直接由詞庫負責。
|
||||||
|
if input.isUpperCaseASCIILetterKey, !input.isCommandHold, !input.isControlHold {
|
||||||
|
if input.isShiftHold { // 這裡先不要判斷 isOptionHold。
|
||||||
|
switch mgrPrefs.upperCaseLetterKeyBehavior {
|
||||||
|
case 1:
|
||||||
|
stateCallback(InputState.Empty())
|
||||||
|
stateCallback(InputState.Committing(textToCommit: inputText.lowercased()))
|
||||||
|
stateCallback(InputState.Empty())
|
||||||
|
return true
|
||||||
|
case 2:
|
||||||
|
stateCallback(InputState.Empty())
|
||||||
|
stateCallback(InputState.Committing(textToCommit: inputText.uppercased()))
|
||||||
|
stateCallback(InputState.Empty())
|
||||||
|
return true
|
||||||
|
default: // 包括 case 0,直接塞給組字區。
|
||||||
|
let letter: String! = String(
|
||||||
|
format: "%@%c", "_letter_", charCode.isPrintableASCII ? CChar(charCode) : inputText)
|
||||||
|
if handlePunctuation(
|
||||||
|
letter,
|
||||||
|
state: state,
|
||||||
|
usingVerticalTyping: input.isTypingVertical,
|
||||||
|
stateCallback: stateCallback,
|
||||||
|
errorCallback: errorCallback
|
||||||
|
) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - 終末處理 (Still Nothing)
|
// MARK: - 終末處理 (Still Nothing)
|
||||||
|
|
||||||
/// 對剩下的漏網之魚做攔截處理、直接將當前狀態繼續回呼給 ctlInputMethod。
|
/// 對剩下的漏網之魚做攔截處理、直接將當前狀態繼續回呼給 ctlInputMethod。
|
||||||
|
|
Loading…
Reference in New Issue