Repo // API changes for further purposes.
This commit is contained in:
parent
87ad7dccbb
commit
fc49bebc5d
|
@ -386,7 +386,7 @@ private extension VwrCandidateTDKCocoa {
|
|||
|
||||
private extension VwrCandidateTDKCocoa {
|
||||
func didSelectCandidateAt(_ pos: Int) {
|
||||
controller?.delegate?.candidatePairSelected(at: pos)
|
||||
controller?.delegate?.candidatePairSelectionConfirmed(at: pos)
|
||||
}
|
||||
|
||||
func didRightClickCandidateAt(_ pos: Int, action: CandidateContextMenuAction) {
|
||||
|
|
|
@ -350,7 +350,7 @@ extension VwrCandidateTDK {
|
|||
@available(macOS 10.15, *)
|
||||
private extension VwrCandidateTDK {
|
||||
func didSelectCandidateAt(_ pos: Int) {
|
||||
controller?.delegate?.candidatePairSelected(at: pos)
|
||||
controller?.delegate?.candidatePairSelectionConfirmed(at: pos)
|
||||
}
|
||||
|
||||
func didRightClickCandidateAt(_ pos: Int, action: CandidateContextMenuAction) {
|
||||
|
|
|
@ -10,7 +10,8 @@ import Cocoa
|
|||
|
||||
public protocol CtlCandidateDelegate {
|
||||
func candidatePairs(conv: Bool) -> [(keyArray: [String], value: String)]
|
||||
func candidatePairSelected(at index: Int)
|
||||
func candidatePairSelectionConfirmed(at index: Int)
|
||||
func candidatePairHighlightChanged(at index: Int)
|
||||
func candidatePairRightClicked(at index: Int, action: CandidateContextMenuAction)
|
||||
func candidates(_ sender: Any!) -> [Any]!
|
||||
@discardableResult func reverseLookup(for value: String) -> [String]
|
||||
|
|
|
@ -66,7 +66,7 @@ public protocol InputHandlerDelegate {
|
|||
func updateVerticalTypingStatus()
|
||||
func switchState(_ newState: IMEStateProtocol)
|
||||
func candidateController() -> CtlCandidateProtocol?
|
||||
func candidateSelectionCalledByInputHandler(at index: Int)
|
||||
func candidateSelectionConfirmedByInputHandler(at index: Int)
|
||||
func performUserPhraseOperation(addToFilter: Bool)
|
||||
-> Bool
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ extension InputHandler {
|
|||
delegate.switchState(IMEState.ofAbortion())
|
||||
return true
|
||||
}
|
||||
delegate.candidateSelectionCalledByInputHandler(at: ctlCandidate.highlightedIndex)
|
||||
delegate.candidateSelectionConfirmedByInputHandler(at: ctlCandidate.highlightedIndex)
|
||||
return true
|
||||
case .kTab:
|
||||
let updated: Bool =
|
||||
|
@ -142,7 +142,7 @@ extension InputHandler {
|
|||
|
||||
if index != NSNotFound {
|
||||
if let candidateIndex = ctlCandidate.candidateIndexAtKeyLabelIndex(index) {
|
||||
delegate.candidateSelectionCalledByInputHandler(at: candidateIndex)
|
||||
delegate.candidateSelectionConfirmedByInputHandler(at: candidateIndex)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ extension InputHandler {
|
|||
|
||||
if shouldAutoSelectCandidate {
|
||||
guard let candidateIndex = ctlCandidate.candidateIndexAtKeyLabelIndex(0) else { return true }
|
||||
delegate.candidateSelectionCalledByInputHandler(at: candidateIndex)
|
||||
delegate.candidateSelectionConfirmedByInputHandler(at: candidateIndex)
|
||||
delegate.switchState(IMEState.ofAbortion())
|
||||
return handleInput(event: input)
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ extension SessionCtl: InputHandlerDelegate {
|
|||
|
||||
public func candidateController() -> CtlCandidateProtocol? { candidateUI }
|
||||
|
||||
public func candidateSelectionCalledByInputHandler(at index: Int) {
|
||||
candidatePairSelected(at: index)
|
||||
public func candidateSelectionConfirmedByInputHandler(at index: Int) {
|
||||
candidatePairSelectionConfirmed(at: index)
|
||||
}
|
||||
|
||||
public func callError(_ logMessage: String) {
|
||||
|
@ -108,7 +108,9 @@ extension SessionCtl: CtlCandidateDelegate {
|
|||
return convertedCandidates
|
||||
}
|
||||
|
||||
public func candidatePairSelected(at index: Int) {
|
||||
public func candidatePairHighlightChanged(at _: Int) {}
|
||||
|
||||
public func candidatePairSelectionConfirmed(at index: Int) {
|
||||
guard let inputHandler = inputHandler else { return }
|
||||
if state.type == .ofSymbolTable, (0 ..< state.node.members.count).contains(index) {
|
||||
let node = state.node.members[index]
|
||||
|
|
|
@ -80,6 +80,7 @@ public extension SessionCtl {
|
|||
}
|
||||
|
||||
/// IMK 選字窗限定函式,只要選字窗確認了某個候選字詞的選擇、就會呼叫這個函式。
|
||||
/// - Remark: 不要被 IMK 的 API 命名方式困惑到。這其實是 Confirm Selection 確認選字。
|
||||
/// - Parameter candidateString: 已經確認的候選字詞內容。
|
||||
override func candidateSelected(_ candidateString: NSAttributedString!) {
|
||||
let candidateString: String = candidateString?.string ?? ""
|
||||
|
@ -150,6 +151,6 @@ public extension SessionCtl {
|
|||
handleIMKCandidatesSelected(state.candidates)
|
||||
}
|
||||
}
|
||||
candidatePairSelected(at: indexDeducted)
|
||||
candidatePairSelectionConfirmed(at: indexDeducted)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue