Implement basic syntax highlighting with syntect in editor example
This commit is contained in:
parent
76dc82e8e8
commit
d3011992a7
5 changed files with 211 additions and 6 deletions
|
|
@ -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>>)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue