neovim-gtk
neovim-gtk copied to clipboard
Use more pointers in `ui_model::model_layout::HighlightedRange`
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
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.