KeyHandler // Documentation fix (continued).

This commit is contained in:
ShikiSuen 2022-06-29 13:34:02 +08:00
parent 5448d20936
commit 449ab61a1b
3 changed files with 5 additions and 5 deletions

View File

@ -244,11 +244,10 @@ class KeyHandler {
/// ///
if arrAnchors.isEmpty { return arrCandidates } if arrAnchors.isEmpty { return arrCandidates }
// sort the nodes, so that longer nodes (representing longer phrases) //
// are placed at the top of the candidate list
arrAnchors = arrAnchors.stableSort { $0.keyLength > $1.keyLength } arrAnchors = arrAnchors.stableSort { $0.keyLength > $1.keyLength }
// then use the Swift trick to retrieve the candidates for each node at/crossing the cursor //
for currentNodeAnchor in arrAnchors { for currentNodeAnchor in arrAnchors {
if let currentNode = currentNodeAnchor.node { if let currentNode = currentNodeAnchor.node {
for currentCandidate in currentNode.candidates { for currentCandidate in currentNode.candidates {
@ -259,6 +258,7 @@ class KeyHandler {
} }
} }
} }
// 調
if mgrPrefs.fetchSuggestionsFromUserOverrideModel, !mgrPrefs.useSCPCTypingMode, !fixOrder { if mgrPrefs.fetchSuggestionsFromUserOverrideModel, !mgrPrefs.useSCPCTypingMode, !fixOrder {
let arrSuggestedUnigrams: [Megrez.Unigram] = fetchSuggestedCandidates().stableSort { $0.score > $1.score } let arrSuggestedUnigrams: [Megrez.Unigram] = fetchSuggestedCandidates().stableSort { $0.score > $1.score }
let arrSuggestedCandidates: [String] = arrSuggestedUnigrams.map(\.keyValue.value) let arrSuggestedCandidates: [String] = arrSuggestedUnigrams.map(\.keyValue.value)

View File

@ -35,7 +35,7 @@ extension KeyHandler {
/// - Parameters: /// - Parameters:
/// - input: /// - input:
/// - state: /// - state:
/// - stateCallback: /// - stateCallback:
/// - errorCallback: /// - errorCallback:
/// - Returns: IMK /// - Returns: IMK
func handleCandidate( func handleCandidate(

View File

@ -36,7 +36,7 @@ extension KeyHandler {
/// - Parameters: /// - Parameters:
/// - input: /// - input:
/// - state: /// - state:
/// - stateCallback: /// - stateCallback:
/// - errorCallback: /// - errorCallback:
/// - Returns: IMK /// - Returns: IMK
func handle( func handle(