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.
This commit is contained in:
osaym authored and GitHub committed 2026-10-15 02:38:32 -04:00
1 parent 8da1d3efce
commit e6e65d0292
2 files changed
+21 -1

No files matched your search

+6 -1
View File
@@ -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| {
+15
View File
@@ -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());
}