From e6e65d029252bf419fe56ed2d1c86e50c1f36de7 Mon Sep 17 00:00:00 2001 From: osaym <68712890+Osaym@users.noreply.github.com> Date: Thu, 15 Oct 2026 02:38:32 -0400 Subject: [PATCH] fix(ui): wrap long filenames and metadata in Document Properties (#2011) (#2012) Wrap text in Document Properties rows within the 420 pt content column so documents with long filenames or metadata do not stretch the modal dialog card beyond the viewport boundaries. Fixes #2011. --- crates/ui-egui/src/dialogs.rs | 7 ++++++- crates/ui-egui/tests/dialog_chrome.rs | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 7d5f60c79f..c1dbd47a00 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -118,7 +118,12 @@ fn dialogs(app: &mut PdfCraftApp, ctx: &egui::Context) { let row = |ui: &mut egui::Ui, k: &str, v: String| { // Row labels are UI chrome; values are document data and stay as they are. ui.label(egui::RichText::new(tl!(k)).color(t.text_muted)); - ui.label(if v.is_empty() { egui::RichText::new("—").color(t.text_faint) } else { egui::RichText::new(v) }); + ui.scope(|ui| { + ui.set_max_width(420.0); + ui.add( + egui::Label::new(if v.is_empty() { egui::RichText::new("—").color(t.text_faint) } else { egui::RichText::new(v) }).wrap(), + ); + }); ui.end_row(); }; egui::ScrollArea::vertical().max_height(460.0).auto_shrink([false, true]).show(ui, |ui| { diff --git a/crates/ui-egui/tests/dialog_chrome.rs b/crates/ui-egui/tests/dialog_chrome.rs index 8a403535eb..57f549305d 100644 --- a/crates/ui-egui/tests/dialog_chrome.rs +++ b/crates/ui-egui/tests/dialog_chrome.rs @@ -81,3 +81,18 @@ fn password_prompt_field_is_tall_and_inset() { let heading = h.get_by_label("Password required").rect(); assert!(heading.top() - card.top() >= 16.0, "heading inset {heading:?} in {card:?}"); } + +#[test] +fn document_properties_long_filename_does_not_overflow_card() { + let long_name = "Global_sociology_introducing_five_contemporary_societies_Schneider_Linda_Silverman_Arnold_2000_Boston_isbn13_9780072294309_hash_3d2960a9212a8573bba2536e91f36e59_archive_copy.pdf"; + let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| { + let mut app = PdfCraftApp::new(); + app.set_option("language", "en").unwrap(); + app.open_bytes(long_name, None, fixture()).unwrap(); + app.set_option("dialog", "properties").unwrap(); + app + }); + h.run_steps(4); + let card = card(&h, "dialog"); + assert!(card.width() <= 700.0, "dialog card should not blow out horizontally on long filename, width was: {}", card.width()); +}