mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Add syntax highlighing feature to egui_extras (#3333)
* Add syntax highlighing feature to egui_extras Enable "syntect" feature for great syntax highlighting of any language. If not a simple fallback is used that works fine for C++, Rust, Python * Check --no-default-features of egui_extras on CI * spelling * Fix building egui_extras without additional features
This commit is contained in:
@@ -67,7 +67,7 @@ impl super::View for CodeEditor {
|
||||
});
|
||||
}
|
||||
|
||||
let mut theme = crate::syntax_highlighting::CodeTheme::from_memory(ui.ctx());
|
||||
let mut theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx());
|
||||
ui.collapsing("Theme", |ui| {
|
||||
ui.group(|ui| {
|
||||
theme.ui(ui);
|
||||
@@ -77,7 +77,7 @@ impl super::View for CodeEditor {
|
||||
|
||||
let mut layouter = |ui: &egui::Ui, string: &str, wrap_width: f32| {
|
||||
let mut layout_job =
|
||||
crate::syntax_highlighting::highlight(ui.ctx(), &theme, string, language);
|
||||
egui_extras::syntax_highlighting::highlight(ui.ctx(), &theme, string, language);
|
||||
layout_job.wrap.max_width = wrap_width;
|
||||
ui.fonts(|f| f.layout_job(layout_job))
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user