Skip to content
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

Fuzzy Select: Special characters lead to panic #181

Closed
deg0nz opened this issue Mar 6, 2022 · 2 comments · Fixed by #245
Closed

Fuzzy Select: Special characters lead to panic #181

deg0nz opened this issue Mar 6, 2022 · 2 comments · Fixed by #245

Comments

@deg0nz
Copy link
Contributor

deg0nz commented Mar 6, 2022

Entering special characters that consist of more than one char (like ä, ö, ü, é, ê, ...) lead to a panic.

This seems to be due to the fact that we use a range in search_term[0..cursor_pos].

I will check, if using Slices fixes the issue.

fuzzy-select-umlaut

Edit: also found this while implementing #179

@deg0nz
Copy link
Contributor Author

deg0nz commented Mar 6, 2022

I digged into this and it seems to be an inherent property of unicode characters. Characters like ä actually are grapheme clusters and have a length of 3 chars. We need to consider that fact when splitting str.

The Rust standard library explicitly says, that it does not solve the iteration over grapheme clusters.

Since fuzzy-select is behind a feature, I suggest we also include https://crates.io/crates/unicode-segmentation for the fuzzy select feature and split the search term with that crate to support non-ascii characters.

@Araxeus
Copy link

Araxeus commented May 9, 2022

This is especially annoying for users that aren't English speakers

For example:
Cyrillic. Hebrew. Chinese, Arabic, etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants