KeyHandler // Optimize punctuationNamePrefix.
This commit is contained in:
parent
dfb1a5dd99
commit
f47824292e
|
@ -413,4 +413,19 @@ class KeyHandler {
|
|||
}
|
||||
return min(nextPosition, compositorLength)
|
||||
}
|
||||
|
||||
/// 生成標點符號索引鍵。
|
||||
/// - Parameter input: 輸入的按鍵訊號。
|
||||
/// - Returns: 生成的標點符號索引鍵。
|
||||
func generatePunctuationNamePrefix(withKeyCondition input: InputSignal) -> String {
|
||||
if mgrPrefs.halfWidthPunctuationEnabled {
|
||||
return "_half_punctuation_"
|
||||
}
|
||||
switch (input.isControlHold, input.isOptionHold) {
|
||||
case (true, true): return "_alt_ctrl_punctuation_"
|
||||
case (true, false): return "_ctrl_punctuation_"
|
||||
case (false, true): return "_alt_punctuation_"
|
||||
case (false, false): return "_punctuation_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,22 +334,8 @@ extension KeyHandler {
|
|||
/// - 是否是針對當前注音排列/拼音輸入種類專門提供的標點符號。
|
||||
/// - 是否是需要摁修飾鍵才可以輸入的那種標點符號。
|
||||
|
||||
var punctuationNamePrefix = ""
|
||||
|
||||
if input.isOptionHold && !input.isControlHold {
|
||||
punctuationNamePrefix = "_alt_punctuation_"
|
||||
} else if input.isControlHold && !input.isOptionHold {
|
||||
punctuationNamePrefix = "_ctrl_punctuation_"
|
||||
} else if input.isControlHold && input.isOptionHold {
|
||||
punctuationNamePrefix = "_alt_ctrl_punctuation_"
|
||||
} else if mgrPrefs.halfWidthPunctuationEnabled {
|
||||
punctuationNamePrefix = "_half_punctuation_"
|
||||
} else {
|
||||
punctuationNamePrefix = "_punctuation_"
|
||||
}
|
||||
|
||||
let punctuationNamePrefix: String = generatePunctuationNamePrefix(withKeyCondition: input)
|
||||
let parser = currentMandarinParser
|
||||
|
||||
let arrCustomPunctuations: [String] = [
|
||||
punctuationNamePrefix, parser, String(format: "%c", CChar(charCode)),
|
||||
]
|
||||
|
|
|
@ -414,20 +414,7 @@ extension KeyHandler {
|
|||
/// - 是否是針對當前注音排列/拼音輸入種類專門提供的標點符號。
|
||||
/// - 是否是需要摁修飾鍵才可以輸入的那種標點符號。
|
||||
|
||||
var punctuationNamePrefix = ""
|
||||
|
||||
if input.isOptionHold && !input.isControlHold {
|
||||
punctuationNamePrefix = "_alt_punctuation_"
|
||||
} else if input.isControlHold && !input.isOptionHold {
|
||||
punctuationNamePrefix = "_ctrl_punctuation_"
|
||||
} else if input.isControlHold && input.isOptionHold {
|
||||
punctuationNamePrefix = "_alt_ctrl_punctuation_"
|
||||
} else if mgrPrefs.halfWidthPunctuationEnabled {
|
||||
punctuationNamePrefix = "_half_punctuation_"
|
||||
} else {
|
||||
punctuationNamePrefix = "_punctuation_"
|
||||
}
|
||||
|
||||
let punctuationNamePrefix: String = generatePunctuationNamePrefix(withKeyCondition: input)
|
||||
let parser = currentMandarinParser
|
||||
let arrCustomPunctuations: [String] = [
|
||||
punctuationNamePrefix, parser, String(format: "%c", CChar(charCode)),
|
||||
|
|
Loading…
Reference in New Issue