KeyHandler // Remove tooltip from buildInputtingState().

This commit is contained in:
ShikiSuen 2022-07-31 22:36:29 +08:00
parent 8d4530b8c3
commit c2189993f2
1 changed files with 3 additions and 45 deletions

View File

@ -86,21 +86,10 @@ extension KeyHandler {
tooltipParameterRef[0] = compositor.readings[compositor.cursor - 1]
tooltipParameterRef[1] = compositor.readings[compositor.cursor]
}
///
guard tooltipParameterRef != ["", ""] else { continue }
for (i, _) in tooltipParameterRef.enumerated() {
if tooltipParameterRef[i].isEmpty { continue }
if tooltipParameterRef[i].contains("_") { continue }
if mgrPrefs.showHanyuPinyinInCompositionBuffer { // ->->調
tooltipParameterRef[i] = Tekkon.restoreToneOneInZhuyinKey(target: tooltipParameterRef[i])
tooltipParameterRef[i] = Tekkon.cnvPhonaToHanyuPinyin(target: tooltipParameterRef[i])
tooltipParameterRef[i] = Tekkon.cnvHanyuPinyinToTextbookStyle(target: tooltipParameterRef[i])
} else {
tooltipParameterRef[i] = Tekkon.cnvZhuyinChainToTextbookReading(target: tooltipParameterRef[i])
}
}
}
isCursorCuttingChar = !tooltipParameterRef[0].isEmpty || !tooltipParameterRef[1].isEmpty
///
/// 便 composer
var arrHead = [String.UTF16View.Element]()
@ -132,38 +121,7 @@ extension KeyHandler {
}
/// 使
let stateResult = InputState.Inputting(composingBuffer: cleanedComposition, cursorIndex: cursorIndex)
///
switch (tooltipParameterRef[0].isEmpty, tooltipParameterRef[1].isEmpty) {
case (true, true): stateResult.tooltip.removeAll()
case (true, false):
stateResult.tooltip = String(
format: NSLocalizedString("Cursor is to the rear of \"%@\".", comment: ""),
tooltipParameterRef[1]
)
case (false, true):
stateResult.tooltip = String(
format: NSLocalizedString("Cursor is in front of \"%@\".", comment: ""),
tooltipParameterRef[0]
)
case (false, false):
stateResult.tooltip = String(
format: NSLocalizedString("Cursor is between \"%@\" and \"%@\".", comment: ""),
tooltipParameterRef[0], tooltipParameterRef[1]
)
}
///
if !stateResult.tooltip.isEmpty {
isCursorCuttingChar = true
ctlInputMethod.tooltipController.setColor(state: .denialOverflow)
} else {
isCursorCuttingChar = false
ctlInputMethod.tooltipController.setColor(state: .normal)
}
return stateResult
return InputState.Inputting(composingBuffer: cleanedComposition, cursorIndex: cursorIndex)
}
// MARK: -