Skip to content

Commit

Permalink
Unique Candidate subNotations
Browse files Browse the repository at this point in the history
  • Loading branch information
bingzheung committed May 28, 2024
1 parent d9f3a16 commit a7950c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CoreIME/Sources/CoreIME/Candidate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public struct Candidate: Hashable {
} else {
items.append(contentsOf: rhs.subNotations)
}
return items
return items.uniqued()
}()
return Candidate(text: newText, lexiconText: newLexiconText, romanization: newRomanization, input: newInput, mark: newMark, subNotations: newSubNotations)
}
Expand Down
2 changes: 1 addition & 1 deletion CoreIME/Sources/CoreIME/Lookup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extension Engine {
let trailingRomanization = syllables.suffix(trailingCount).joined(separator: String.space)
let leadingNotation = fetchNotation(word: leadingText, romanization: leadingRomanization)
let trailingNotation = fetchNotation(word: trailingText, romanization: trailingRomanization)
let subNotations: [Notation] = [leadingNotation, trailingNotation].compactMap({ $0 })
let subNotations: [Notation] = [leadingNotation, trailingNotation].compactMap({ $0 }).uniqued()
return Candidate(text: text, romanization: romanization, input: origin.input, mark: origin.mark, subNotations: subNotations)
default:
return origin
Expand Down

0 comments on commit a7950c2

Please sign in to comment.