TDKCandidates // Force-refresh reverse lookup results on refresh.

This commit is contained in:
ShikiSuen 2024-02-17 12:41:18 +08:00
parent 63f7cc91fc
commit b20dfec630
1 changed files with 4 additions and 1 deletions

View File

@ -112,6 +112,9 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate {
guard let self = self else { return } guard let self = self else { return }
self.updateNSWindowModern(window) self.updateNSWindowModern(window)
} }
//
reverseLookupResult = []
//
if let currentCandidate = Self.thePool.currentCandidate { if let currentCandidate = Self.thePool.currentCandidate {
let displayedText = currentCandidate.displayedText let displayedText = currentCandidate.displayedText
var lookupResult: [String?] = delegate?.reverseLookup(for: displayedText) ?? [] var lookupResult: [String?] = delegate?.reverseLookup(for: displayedText) ?? []
@ -128,8 +131,8 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate {
reverseLookupResult = [lookupResult.compactMap { $0 }.first].compactMap { $0 } reverseLookupResult = [lookupResult.compactMap { $0 }.first].compactMap { $0 }
} }
} }
Self.thePool.reverseLookupResult = reverseLookupResult
} }
Self.thePool.reverseLookupResult = reverseLookupResult
Self.thePool.tooltip = delegate?.candidateToolTip(shortened: !Self.thePool.isMatrix) ?? "" Self.thePool.tooltip = delegate?.candidateToolTip(shortened: !Self.thePool.isMatrix) ?? ""
delegate?.candidatePairHighlightChanged(at: highlightedIndex) delegate?.candidatePairHighlightChanged(at: highlightedIndex)
} }