neovim-gtk icon indicating copy to clipboard operation
neovim-gtk copied to clipboard

Use more pointers in `ui_model::model_layout::HighlightedRange`

Open Lyude opened this issue 2 years ago • 1 comments

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 :man_shrugging:

Originally posted by @theHamsta in https://github.com/Lyude/neovim-gtk/pull/74#discussion_r1063736397

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 avatar Jan 06 '23 21:01 Lyude

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.

theHamsta avatar Jan 06 '23 22:01 theHamsta