Cache syntax highlighting results

This commit is contained in:
Jeremy Soller 2022-10-26 22:25:37 -06:00
parent f85223b376
commit 1e1164f4b2
2 changed files with 73 additions and 18 deletions

View file

@ -201,6 +201,10 @@ impl<'a> TextBufferLine<'a> {
self.layout_opt = None;
}
pub fn is_reset(&self) -> bool {
self.shape_opt.is_none()
}
pub fn shape(&mut self, font_system: &'a FontSystem<'a>) -> &ShapeLine {
if self.shape_opt.is_none() {
self.shape_opt = Some(ShapeLine::new(font_system, &self.text, &self.attrs_list));