use eframe::egui; fn main() -> eframe::Result { let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default().with_inner_size([1024.0, 768.0]), ..Default::default() }; let mut code = String::new(); eframe::run_simple_native("Cells", options, move |ctx, _frame| { egui::CentralPanel::default().show(ctx, |ui| { let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx()); let mut layouter = |ui: &egui::Ui, string: &str, wrap_width: f32| { let mut layout_job = egui_extras::syntax_highlighting::highlight(ui.ctx(), &theme, string, "Python"); layout_job.wrap.max_width = wrap_width; layout_job.sections = layout_job .sections .iter() .map(|layout_section| { let mut section = layout_section.clone(); section.format.font_id = egui::FontId::monospace(16.0); section }) .collect(); ui.fonts(|f| f.layout_job(layout_job)) }; ui.add( egui::TextEdit::multiline(&mut code) .code_editor() .desired_rows(4) .lock_focus(true) .desired_width(f32::INFINITY) .layouter(&mut layouter) .font(egui::FontId::monospace(16.0)), ); }); }) }