From b20dfec63047b2e49626aa14588c3287c1c61f4f Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 17 Feb 2024 12:41:18 +0800 Subject: [PATCH] TDKCandidates // Force-refresh reverse lookup results on refresh. --- .../CandidateWindow/TDKCandidates/CtlCandidateTDK.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift index ad86f1e8..6ae91ef4 100644 --- a/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift +++ b/Packages/vChewing_CandidateWindow/Sources/CandidateWindow/TDKCandidates/CtlCandidateTDK.swift @@ -112,6 +112,9 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate { guard let self = self else { return } self.updateNSWindowModern(window) } + // 先擦除之前的反查结果。 + reverseLookupResult = [] + // 再更新新的反查结果。 if let currentCandidate = Self.thePool.currentCandidate { let displayedText = currentCandidate.displayedText var lookupResult: [String?] = delegate?.reverseLookup(for: displayedText) ?? [] @@ -128,8 +131,8 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate { reverseLookupResult = [lookupResult.compactMap { $0 }.first].compactMap { $0 } } } - Self.thePool.reverseLookupResult = reverseLookupResult } + Self.thePool.reverseLookupResult = reverseLookupResult Self.thePool.tooltip = delegate?.candidateToolTip(shortened: !Self.thePool.isMatrix) ?? "" delegate?.candidatePairHighlightChanged(at: highlightedIndex) }