KeyHandler // Upgrade to cope with recent UOM upgrades.

This commit is contained in:
ShikiSuen 2022-06-22 15:27:28 +08:00
parent 265cfbb21a
commit d762bac9cd
2 changed files with 11 additions and 7 deletions

View File

@ -266,18 +266,22 @@ class KeyHandler {
return arrCandidates return arrCandidates
} }
/// ///
func fetchSuggestionsFromUserOverrideModel() { func fetchSuggestedCandidates() -> [Megrez.Unigram] {
currentUOM.suggest(
walkedAnchors: walkedAnchors, cursorIndex: compositorCursorIndex,
timestamp: NSDate().timeIntervalSince1970)
}
///
func fetchAndApplySuggestionsFromUserOverrideModel() {
/// ///
if !mgrPrefs.fetchSuggestionsFromUserOverrideModel { return } if !mgrPrefs.fetchSuggestionsFromUserOverrideModel { return }
/// trigram /// trigram
let overrideValue = let overrideValue =
mgrPrefs.useSCPCTypingMode mgrPrefs.useSCPCTypingMode
? "" ? ""
: currentUOM.suggest( : fetchSuggestedCandidates().first?.keyValue.value ?? ""
walkedAnchors: walkedAnchors, cursorIndex: compositorCursorIndex,
timestamp: NSDate().timeIntervalSince1970
)
/// ///
if !overrideValue.isEmpty { if !overrideValue.isEmpty {

View File

@ -195,7 +195,7 @@ extension KeyHandler {
let textToCommit = popOverflowComposingTextAndWalk let textToCommit = popOverflowComposingTextAndWalk
// //
fetchSuggestionsFromUserOverrideModel() fetchAndApplySuggestionsFromUserOverrideModel()
// //
markNodesFixedIfNecessary() markNodesFixedIfNecessary()