IME // charDeDuplicate -> deduplicate; +cleanup.

This commit is contained in:
ShikiSuen 2022-06-22 17:53:58 +08:00
parent 77dd885ca9
commit 40c3b3042c
3 changed files with 3 additions and 3 deletions

View File

@ -373,7 +373,7 @@ public enum IME {
// Extend the RangeReplaceableCollection to allow it clean duplicated characters.
// Ref: https://stackoverflow.com/questions/25738817/
extension RangeReplaceableCollection where Element: Hashable {
var charDeDuplicate: Self {
var deduplicate: Self {
var set = Set<Element>()
return filter { set.insert($0).inserted }
}

View File

@ -65,7 +65,7 @@ struct suiPrefPaneExperience: View {
ComboBox(items: mgrPrefs.suggestedCandidateKeys, text: $selSelectionKeys).frame(width: 180).onChange(
of: selSelectionKeys
) { value in
let keys: String = (value.trimmingCharacters(in: .whitespacesAndNewlines) as String).charDeDuplicate
let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicate
do {
try mgrPrefs.validate(candidateKeys: keys)
mgrPrefs.candidateKeys = keys

View File

@ -228,7 +228,7 @@ class ctlPrefWindow: NSWindowController {
let keys = (sender as AnyObject).stringValue?.trimmingCharacters(
in: .whitespacesAndNewlines
)
.charDeDuplicate
.deduplicate
else {
return
}