Repo // Make candidateIndexAtKeyLabelIndex() nullable.
This commit is contained in:
parent
2289be50b6
commit
888e6a9ddf
|
@ -109,7 +109,7 @@ open class CtlCandidate: NSWindowController, CtlCandidateProtocol {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
open func candidateIndexAtKeyLabelIndex(_: Int) -> Int {
|
open func candidateIndexAtKeyLabelIndex(_: Int) -> Int? {
|
||||||
Int.max
|
Int.max
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public protocol CtlCandidateProtocol {
|
||||||
func showPreviousLine() -> Bool
|
func showPreviousLine() -> Bool
|
||||||
func highlightNextCandidate() -> Bool
|
func highlightNextCandidate() -> Bool
|
||||||
func highlightPreviousCandidate() -> Bool
|
func highlightPreviousCandidate() -> Bool
|
||||||
func candidateIndexAtKeyLabelIndex(_: Int) -> Int
|
func candidateIndexAtKeyLabelIndex(_: Int) -> Int?
|
||||||
func set(windowTopLeftPoint: NSPoint, bottomOutOfScreenAdjustmentHeight height: Double, useGCD: Bool)
|
func set(windowTopLeftPoint: NSPoint, bottomOutOfScreenAdjustmentHeight height: Double, useGCD: Bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,7 @@ extension InputHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if index != NSNotFound {
|
if index != NSNotFound {
|
||||||
let candidateIndex = ctlCandidate.candidateIndexAtKeyLabelIndex(index)
|
if let candidateIndex = ctlCandidate.candidateIndexAtKeyLabelIndex(index) {
|
||||||
if candidateIndex != -114_514 {
|
|
||||||
delegate.candidateSelectionCalledByInputHandler(at: candidateIndex)
|
delegate.candidateSelectionCalledByInputHandler(at: candidateIndex)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -185,13 +184,10 @@ extension InputHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if shouldAutoSelectCandidate {
|
if shouldAutoSelectCandidate {
|
||||||
let candidateIndex = ctlCandidate.candidateIndexAtKeyLabelIndex(0)
|
guard let candidateIndex = ctlCandidate.candidateIndexAtKeyLabelIndex(0) else { return true }
|
||||||
if candidateIndex != -114_514 {
|
delegate.candidateSelectionCalledByInputHandler(at: candidateIndex)
|
||||||
delegate.candidateSelectionCalledByInputHandler(at: candidateIndex)
|
delegate.switchState(IMEState.ofAbortion())
|
||||||
delegate.switchState(IMEState.ofAbortion())
|
return handleInput(event: input)
|
||||||
return handleInput(event: input)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class CtlCandidateIMK: IMKCandidates, CtlCandidateProtocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMK 選字窗目前無法實作該函式。威注音 IMK 選字窗目前也不需要使用該函式。
|
// IMK 選字窗目前無法實作該函式。威注音 IMK 選字窗目前也不需要使用該函式。
|
||||||
public func candidateIndexAtKeyLabelIndex(_: Int) -> Int { 0 }
|
public func candidateIndexAtKeyLabelIndex(_: Int) -> Int? { 0 }
|
||||||
|
|
||||||
public var highlightedIndex: Int {
|
public var highlightedIndex: Int {
|
||||||
get { selectedCandidate() }
|
get { selectedCandidate() }
|
||||||
|
|
Loading…
Reference in New Issue