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

ui: UTF-8 support in input fields #786

Merged
merged 1 commit into from
Sep 3, 2024
Merged

ui: UTF-8 support in input fields #786

merged 1 commit into from
Sep 3, 2024

Conversation

not-fl3
Copy link
Owner

@not-fl3 not-fl3 commented Sep 2, 2024

This PR trades UTF8 support for one extra memory allocation per input field.

Before, all UI code was using &mut String and was operating right on the user data, reallocating memory only when neccesary. After, each input field copies String into a Vec, and than copies the data back.

Technically, all the UTF8 bugs are fixable without Vec, we just need to make a very clear distinguish for "cursor pointing into a character"/"cursor pointing into a byte". With a lot faster navigation/slicing of Vec than a a char's iterator from a string, perfomance/memory tradeoff is not super obvious, and with implementation being so much easier with a Vec - let's chose this route.

@not-fl3 not-fl3 merged commit 17b7ed1 into master Sep 3, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant