Repo // Updating bleachSpecifiedSuggestions() to add batch processing.
This commit is contained in:
parent
bf6bc90238
commit
646ca310c6
|
@ -154,10 +154,13 @@ extension vChewingLM.LMUserOverride {
|
||||||
// MARK: - Hash and Dehash the entire UOM data, etc.
|
// MARK: - Hash and Dehash the entire UOM data, etc.
|
||||||
|
|
||||||
extension vChewingLM.LMUserOverride {
|
extension vChewingLM.LMUserOverride {
|
||||||
public func bleachSpecifiedSuggestions(target: String, saveCallback: @escaping () -> Void) {
|
public func bleachSpecifiedSuggestions(targets: [String], saveCallback: @escaping () -> Void) {
|
||||||
|
if targets.isEmpty { return }
|
||||||
for neta in mutLRUMap {
|
for neta in mutLRUMap {
|
||||||
if neta.value.observation.overrides.keys.contains(target) {
|
for target in targets {
|
||||||
mutLRUMap.removeValue(forKey: neta.key)
|
if neta.value.observation.overrides.keys.contains(target) {
|
||||||
|
mutLRUMap.removeValue(forKey: neta.key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resetMRUList()
|
resetMRUList()
|
||||||
|
|
|
@ -610,12 +610,12 @@ public enum LMMgr {
|
||||||
group.notify(queue: DispatchQueue.main) {}
|
group.notify(queue: DispatchQueue.main) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func bleachSpecifiedSuggestions(target: String, mode: Shared.InputMode) {
|
public static func bleachSpecifiedSuggestions(targets: [String], mode: Shared.InputMode) {
|
||||||
switch mode {
|
switch mode {
|
||||||
case .imeModeCHS:
|
case .imeModeCHS:
|
||||||
Self.uomCHT.bleachSpecifiedSuggestions(target: target, saveCallback: { Self.uomCHT.saveData() })
|
Self.uomCHT.bleachSpecifiedSuggestions(targets: targets, saveCallback: { Self.uomCHT.saveData() })
|
||||||
case .imeModeCHT:
|
case .imeModeCHT:
|
||||||
Self.uomCHS.bleachSpecifiedSuggestions(target: target, saveCallback: { Self.uomCHS.saveData() })
|
Self.uomCHS.bleachSpecifiedSuggestions(targets: targets, saveCallback: { Self.uomCHS.saveData() })
|
||||||
case .imeModeNULL:
|
case .imeModeNULL:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ extension SessionCtl: KeyHandlerDelegate {
|
||||||
let rawPair = state.data.userPhraseKVPair
|
let rawPair = state.data.userPhraseKVPair
|
||||||
let valueCurrent = rawPair.1
|
let valueCurrent = rawPair.1
|
||||||
let valueReversed = ChineseConverter.crossConvert(rawPair.1)
|
let valueReversed = ChineseConverter.crossConvert(rawPair.1)
|
||||||
LMMgr.bleachSpecifiedSuggestions(target: valueCurrent, mode: IMEApp.currentInputMode)
|
LMMgr.bleachSpecifiedSuggestions(targets: [valueCurrent], mode: IMEApp.currentInputMode)
|
||||||
LMMgr.bleachSpecifiedSuggestions(target: valueReversed, mode: IMEApp.currentInputMode.reversed)
|
LMMgr.bleachSpecifiedSuggestions(targets: [valueReversed], mode: IMEApp.currentInputMode.reversed)
|
||||||
// 清詞完畢
|
// 清詞完畢
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue