Repo // selectedCandidateIndex -> highlightedIndex.

This commit is contained in:
ShikiSuen 2022-10-14 14:26:34 +08:00
parent b6b647d822
commit 1324e0a077
5 changed files with 10 additions and 10 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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 }

View File

@ -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
}

View File

@ -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) }
}