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 { open var visible = false {
didSet { didSet {
NSObject.cancelPreviousPerformRequests(withTarget: self) NSObject.cancelPreviousPerformRequests(withTarget: self)

View File

@ -208,7 +208,7 @@ public class CtlCandidateTDK: CtlCandidate {
return arrCurrentLine[actualID].index return arrCurrentLine[actualID].index
} }
override public var selectedCandidateIndex: Int { override public var highlightedIndex: Int {
get { thePool.highlightedIndex } get { thePool.highlightedIndex }
set { set {
thePool.highlight(at: newValue) thePool.highlight(at: newValue)

View File

@ -20,7 +20,7 @@ public protocol CtlCandidateProtocol {
var locale: String { get set } var locale: String { get set }
var currentLayout: NSUserInterfaceLayoutOrientation { get set } var currentLayout: NSUserInterfaceLayoutOrientation { get set }
var delegate: CtlCandidateDelegate? { get set } var delegate: CtlCandidateDelegate? { get set }
var selectedCandidateIndex: Int { get set } var highlightedIndex: Int { get set }
var visible: Bool { get set } var visible: Bool { get set }
var windowTopLeftPoint: NSPoint { get set } var windowTopLeftPoint: NSPoint { get set }
var candidateFont: NSFont { get set } var candidateFont: NSFont { get set }

View File

@ -59,7 +59,7 @@ extension InputHandler {
delegate.switchState(IMEState.ofAbortion()) delegate.switchState(IMEState.ofAbortion())
return true return true
} }
delegate.candidateSelectionCalledByInputHandler(at: ctlCandidate.selectedCandidateIndex) delegate.candidateSelectionCalledByInputHandler(at: ctlCandidate.highlightedIndex)
return true return true
case .kTab: case .kTab:
let updated: Bool = let updated: Bool =
@ -104,14 +104,14 @@ extension InputHandler {
return true return true
case .kHome: case .kHome:
_ = _ =
(ctlCandidate.selectedCandidateIndex == 0) (ctlCandidate.highlightedIndex == 0)
? delegate.callError("9B6EDE8D") : (ctlCandidate.selectedCandidateIndex = 0) ? delegate.callError("9B6EDE8D") : (ctlCandidate.highlightedIndex = 0)
return true return true
case .kEnd: case .kEnd:
let maxIndex = state.candidates.count - 1 let maxIndex = state.candidates.count - 1
_ = _ =
(ctlCandidate.selectedCandidateIndex == maxIndex) (ctlCandidate.highlightedIndex == maxIndex)
? delegate.callError("9B69AAAD") : (ctlCandidate.selectedCandidateIndex = maxIndex) ? delegate.callError("9B69AAAD") : (ctlCandidate.highlightedIndex = maxIndex)
return true return true
default: break default: break
} }

View File

@ -96,7 +96,7 @@ public class CtlCandidateIMK: IMKCandidates, CtlCandidateProtocol {
// guard let delegate = delegate else { return } // // guard let delegate = delegate else { return } //
// //
// setCandidateData(candidates) // // setCandidateData(candidates) //
selectedCandidateIndex = 0 highlightedIndex = 0
update() update()
} }
@ -142,7 +142,7 @@ public class CtlCandidateIMK: IMKCandidates, CtlCandidateProtocol {
// IMK IMK 使 // IMK IMK 使
public func candidateIndexAtKeyLabelIndex(_: Int) -> Int { 0 } public func candidateIndexAtKeyLabelIndex(_: Int) -> Int { 0 }
public var selectedCandidateIndex: Int { public var highlightedIndex: Int {
get { selectedCandidate() } get { selectedCandidate() }
set { selectCandidate(withIdentifier: newValue) } set { selectCandidate(withIdentifier: newValue) }
} }