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
}
///
func fetchSuggestionsFromUserOverrideModel() {
///
func fetchSuggestedCandidates() -> [Megrez.Unigram] {
currentUOM.suggest(
walkedAnchors: walkedAnchors, cursorIndex: compositorCursorIndex,
timestamp: NSDate().timeIntervalSince1970)
}
///
func fetchAndApplySuggestionsFromUserOverrideModel() {
///
if !mgrPrefs.fetchSuggestionsFromUserOverrideModel { return }
/// trigram
let overrideValue =
mgrPrefs.useSCPCTypingMode
? ""
: currentUOM.suggest(
walkedAnchors: walkedAnchors, cursorIndex: compositorCursorIndex,
timestamp: NSDate().timeIntervalSince1970
)
: fetchSuggestedCandidates().first?.keyValue.value ?? ""
///
if !overrideValue.isEmpty {

View File

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