diff --git a/src/app/ui.rs b/src/app/ui.rs index 7975863..0e5fb06 100644 --- a/src/app/ui.rs +++ b/src/app/ui.rs @@ -546,13 +546,18 @@ impl App { if self.config.show_preview { // Editor + read-only source-ish preview side by side. let full = ui.available_size(); + // Both columns need an explicit top-down layout: a child + // `Ui` inherits its parent's, and inside `horizontal_top` + // that is left-to-right, which would run every paragraph + // of the preview onto one line. + let down = egui::Layout::top_down(egui::Align::Min); ui.horizontal_top(|ui| { let col_w = full.x / 2.0 - 6.0; - ui.allocate_ui(egui::vec2(col_w, full.y), |ui| { + ui.allocate_ui_with_layout(egui::vec2(col_w, full.y), down, |ui| { self.editor(ui); }); ui.separator(); - ui.allocate_ui(egui::vec2(col_w, full.y), |ui| { + ui.allocate_ui_with_layout(egui::vec2(col_w, full.y), down, |ui| { egui::ScrollArea::vertical() .id_salt("preview") .auto_shrink([false, false])