-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autocomplete: In @-mention results, match insensitively to diacritics #237
Comments
(In principle this should also apply to user-group mentions, not just user mentions. User-group mention autocomplete hasn't been implemented yet: #233.) |
Can we use something like diacritic? |
It looks like that package consists of a hand-maintained set of mappings: The Zulip web client and the legacy zulip-mobile app have functionality like this. So let's implement the same behavior they have. That behavior has been stable for a long time and I'm not aware of any bug reports we've gotten about it. If we later learn about ways the behavior can be improved, we can make the improvement for web too at the same time. |
After taking a look back at the mobile app implementation for this feature I found that it depends on @zulip/shared to handle this. check: import * as typeahead from '@zulip/shared/js/typeahead';
const loweredFilter = filter.toLowerCase();
const isAscii = /^[a-z]+$/.test(loweredFilter);
return users.filter(user => {
const full_name = isAscii ? typeahead.remove_diacritics(user.full_name) : user.full_name;
return user.user_id !== ownUserId && full_name.toLowerCase().startsWith(loweredFilter);
}); Which uses the convenient Js String built in method file: @zulip/shared/lib/typeahead.js const unicode_marks = /\p{M}/gu;
export function remove_diacritics(s) {
return s.normalize("NFKD").replace(unicode_marks, "");
} Which unfortunately dart does not have for now at least so we might have to consider third party packages, I am still searching and evaluating the options but I found several candidates: So I will do some research to be able make an educated suggestion |
Updating this thread with a conclusion from chat and the PR thread #588 (comment) : We'd use |
When making the search "fuzzy" like this, ideally we'd prioritize non-fuzzy matches over fuzzy matches. (zulip/zulip#32634 gave me the idea to comment here; we can split this to a new issue if helpful.) |
If there's a user with
Étienne
in their name, we should still include it in the results for the queryetienne
.The matching is already case-insensitive, but it should be insensitive to diacritics too.
The text was updated successfully, but these errors were encountered: