Implement basic syntax highlighting with syntect in editor example

This commit is contained in:
Héctor Ramón Jiménez 2023-09-17 19:03:58 +02:00
parent 76dc82e8e8
commit d3011992a7
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 211 additions and 6 deletions

View file

@ -81,6 +81,24 @@ where
self.padding = padding.into();
self
}
pub fn highlight<H: text::Highlighter>(
self,
settings: H::Settings,
) -> TextEditor<'a, H, Message, Renderer> {
TextEditor {
content: self.content,
font: self.font,
text_size: self.text_size,
line_height: self.line_height,
width: self.width,
height: self.height,
padding: self.padding,
style: self.style,
on_edit: self.on_edit,
highlighter_settings: settings,
}
}
}
pub struct Content<R = crate::Renderer>(RefCell<Internal<R>>)