Lay the preview pane out down the page, not across it

The preview rendered the whole document as one clipped line running off
the right edge.

An egui child `Ui` inherits its parent's layout, and `ScrollArea` passes
that layout straight through to its content. Both columns were allocated
with `allocate_ui` inside `horizontal_top`, so the preview's content ui
was left-to-right: every `ui.label` in `render_preview` was placed beside
the previous one instead of below it. The editor escaped notice because
it is a single `TextEdit` widget, so a horizontal layout looks the same.

Allocate both columns with an explicit top-down layout instead. The
editor did not need it, but leaving one column implicit is how this would
come back.

Verified by running the app against an isolated config before and after:
the old binary shows "Title: The Opening  Slug: opening  Rough Dra..." on
one line; the new one wraps paragraphs to the column and sizes headings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GLYKcrX18ytCCuKozDXk6
This commit is contained in:
2026-08-26 19:53:27 -05:00
parent 5a5017def8
commit a23cd5abfe
+7 -2
View File
@@ -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])