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 {
|
open var visible = false {
|
||||||
didSet {
|
didSet {
|
||||||
NSObject.cancelPreviousPerformRequests(withTarget: self)
|
NSObject.cancelPreviousPerformRequests(withTarget: self)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue