Skip to content

Commit 8af261d

Browse files
authored
fix: properly highlight search results with accents and diacritics (#661)
Refs: FossifyOrg/Contacts#12
1 parent 24bcdef commit 8af261d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Fixed
99
- Fixed overlap between the call screen avatar and the camera notch ([#645])
1010
- Fixed overlap between the call-on-hold banner and the status bar
11+
- Fixed search highlighting for characters with accents and diacritics
1112

1213
## [1.9.0] - 2025-11-03
1314
### Added

app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,10 @@ class ContactsAdapter(
391391
text = if (textToHighlight.isEmpty()) {
392392
name
393393
} else {
394-
if (name.contains(textToHighlight, true)) {
395-
name.highlightTextPart(textToHighlight, properPrimaryColor)
394+
val normalizedName = name.normalizeString()
395+
val normalizedSearchText = textToHighlight.normalizeString()
396+
if (normalizedName.contains(normalizedSearchText, true)) {
397+
name.highlightTextPart(normalizedSearchText, properPrimaryColor)
396398
} else {
397399
var spacedTextToHighlight = textToHighlight
398400
val strippedName = name.filterNot { it.isWhitespace() }

0 commit comments

Comments
 (0)