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

Use more pointers in ui_model::model_layout::HighlightedRange #78

Open
Lyude opened this issue Jan 6, 2023 · 1 comment
Open

Use more pointers in ui_model::model_layout::HighlightedRange #78

Lyude opened this issue Jan 6, 2023 · 1 comment
Labels
enhancement New feature or request low priority A low priority issue

Comments

@Lyude
Copy link
Owner

Lyude commented Jan 6, 2023

this is a bit a weird data structure to have one string for each grapheme. Probably, one could use the grapheme offsets + original string or use crates like smolstr, that would enable small string optimizations to avoid allocating for each character on screen. but since current code seems to work 🤷‍♂️

Originally posted by @theHamsta in #74 (comment)

Not a bad idea to clean this up at some point, so just making this issue as a TODO so I don't forget about it

@Lyude Lyude added enhancement New feature or request low priority A low priority issue labels Jan 6, 2023
@theHamsta
Copy link

theHamsta commented Jan 6, 2023

The indices of https://docs.rs/unicode-segmentation/latest/unicode_segmentation/trait.UnicodeSegmentation.html#tymethod.grapheme_indices would probably enough when the original string is still stored somewhere. Or also &str (ptr+len) would be lighter than string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority A low priority issue
Projects
None yet
Development

No branches or pull requests

2 participants