Repo // selectedCandidateIndex -> highlightedIndex.
This commit is contained in:
parent
b6b647d822
commit
1324e0a077
|
@ -57,7 +57,7 @@ open class CtlCandidate: NSWindowController, CtlCandidateProtocol {
|
|||
}
|
||||
}
|
||||
|
||||
open var selectedCandidateIndex: Int = .max
|
||||
open var highlightedIndex: Int = .max
|
||||
open var visible = false {
|
||||
didSet {
|
||||
NSObject.cancelPreviousPerformRequests(withTarget: self)
|
||||
|
|
|
@ -208,7 +208,7 @@ public class CtlCandidateTDK: CtlCandidate {
|
|||
return arrCurrentLine[actualID].index
|
||||
}
|
||||
|
||||
override public var selectedCandidateIndex: Int {
|
||||
override public var highlightedIndex: Int {
|
||||
get { thePool.highlightedIndex }
|
||||
set {
|
||||
thePool.highlight(at: newValue)
|
||||
|
|
|
@ -20,7 +20,7 @@ public protocol CtlCandidateProtocol {
|
|||
var locale: String { get set }
|
||||
var currentLayout: NSUserInterfaceLayoutOrientation { get set }
|
||||
var delegate: CtlCandidateDelegate? { get set }
|
||||
var selectedCandidateIndex: Int { get set }
|
||||
var highlightedIndex: Int { get set }
|
||||
var visible: Bool { get set }
|
||||
var windowTopLeftPoint: NSPoint { get set }
|
||||
var candidateFont: NSFont { get set }
|
||||
|
|
|
@ -59,7 +59,7 @@ extension InputHandler {
|
|||
delegate.switchState(IMEState.ofAbortion())
|
||||
return true
|
||||
}
|
||||
delegate.candidateSelectionCalledByInputHandler(at: ctlCandidate.selectedCandidateIndex)
|
||||
delegate.candidateSelectionCalledByInputHandler(at: ctlCandidate.highlightedIndex)
|
||||
return true
|
||||
case .kTab:
|
||||
let updated: Bool =
|
||||
|
@ -104,14 +104,14 @@ extension InputHandler {
|
|||
return true
|
||||
case .kHome:
|
||||
_ =
|
||||
(ctlCandidate.selectedCandidateIndex == 0)
|
||||
? delegate.callError("9B6EDE8D") : (ctlCandidate.selectedCandidateIndex = 0)
|
||||
(ctlCandidate.highlightedIndex == 0)
|
||||
? delegate.callError("9B6EDE8D") : (ctlCandidate.highlightedIndex = 0)
|
||||
return true
|
||||
case .kEnd:
|
||||
let maxIndex = state.candidates.count - 1
|
||||
_ =
|
||||
(ctlCandidate.selectedCandidateIndex == maxIndex)
|
||||
? delegate.callError("9B69AAAD") : (ctlCandidate.selectedCandidateIndex = maxIndex)
|
||||
(ctlCandidate.highlightedIndex == maxIndex)
|
||||
? delegate.callError("9B69AAAD") : (ctlCandidate.highlightedIndex = maxIndex)
|
||||
return true
|
||||
default: break
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class CtlCandidateIMK: IMKCandidates, CtlCandidateProtocol {
|
|||
// guard let delegate = delegate else { return } // 下文無效,所以這句沒用。
|
||||
// 既然下述函式無效,那中間這段沒用的也都砍了。
|
||||
// setCandidateData(candidates) // 該函式無效。
|
||||
selectedCandidateIndex = 0
|
||||
highlightedIndex = 0
|
||||
update()
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class CtlCandidateIMK: IMKCandidates, CtlCandidateProtocol {
|
|||
// IMK 選字窗目前無法實作該函式。威注音 IMK 選字窗目前也不需要使用該函式。
|
||||
public func candidateIndexAtKeyLabelIndex(_: Int) -> Int { 0 }
|
||||
|
||||
public var selectedCandidateIndex: Int {
|
||||
public var highlightedIndex: Int {
|
||||
get { selectedCandidate() }
|
||||
set { selectCandidate(withIdentifier: newValue) }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue