IME // charDeDuplicate -> deduplicate; +cleanup.
This commit is contained in:
parent
77dd885ca9
commit
40c3b3042c
|
@ -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 }
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -228,7 +228,7 @@ class ctlPrefWindow: NSWindowController {
|
|||
let keys = (sender as AnyObject).stringValue?.trimmingCharacters(
|
||||
in: .whitespacesAndNewlines
|
||||
)
|
||||
.charDeDuplicate
|
||||
.deduplicate
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue