From faa01ff673cd5f5e3b1d3af952b80846c3d13214 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 16:59:57 +0000 Subject: [PATCH] Get the Missing Fonts: the box with nothing to download is one row tall Its Close button's far-side layout took the rest of the window's height. The button row is now a row of its own, shared by both forms of the box. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01GBVQLv63guWCuWUM3SctPP --- crates/ui-egui/src/dialogs.rs | 2 +- crates/ui-egui/src/dialogs/chrome.rs | 2 +- crates/ui-egui/src/font_download.rs | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 7f60084f0b..069ff49027 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -35,7 +35,7 @@ use bookmarks::bookmark_at_caret; use bookmarks::bookmark_names; pub use chrome::show; pub(crate) use chrome::{ - block_behind, buttons, cancel_key_pressed, close_button, color_menu, drag_by_title_bar, forget_nudge, ok_cancel_responses, release_keyboard, + block_behind, buttons, cancel_key_pressed, color_menu, drag_by_title_bar, forget_nudge, ok_cancel_responses, release_keyboard, }; pub(crate) use dispatch::search_results; pub(crate) use find::swallow_shortcut_text; diff --git a/crates/ui-egui/src/dialogs/chrome.rs b/crates/ui-egui/src/dialogs/chrome.rs index 9782397c9e..4a1a0e54b7 100644 --- a/crates/ui-egui/src/dialogs/chrome.rs +++ b/crates/ui-egui/src/dialogs/chrome.rs @@ -303,7 +303,7 @@ pub(crate) fn buttons(ui: &mut Ui, ok: &str) -> (bool, bool) { } /// A dialog's single Close button (Escape too). -pub(crate) fn close_button(ui: &mut Ui) -> bool { +pub(super) fn close_button(ui: &mut Ui) -> bool { ui.add_space(8.0); let mut close = ui.input(|i| i.key_pressed(egui::Key::Escape)); ui.with_layout(crate::rtl::far_side(ui, egui::Align::Center), |ui| { diff --git a/crates/ui-egui/src/font_download.rs b/crates/ui-egui/src/font_download.rs index 82406643ab..8a7f6ee5cb 100644 --- a/crates/ui-egui/src/font_download.rs +++ b/crates/ui-egui/src/font_download.rs @@ -110,12 +110,26 @@ fn system_install_steps() -> &'static str { } } +/// The box's last row: `start` at the near side, Close (Escape too) at the far side. In a row +/// of its own, so the far-side layout takes one row's height and not the rest of the window's. +fn close_row(ui: &mut egui::Ui, start: impl FnOnce(&mut egui::Ui)) -> bool { + let mut close = ui.input(|i| i.key_pressed(egui::Key::Escape)); + ui.horizontal(|ui| { + start(ui); + ui.with_layout(crate::rtl::far_side(ui, egui::Align::Center), |ui| { + close |= ui.add(crate::widgets::primary_button(ui, tl!("Close"))).clicked(); + }); + }); + close +} + /// The box's content. Returns true to close. pub(crate) fn body(app: &mut WordApp, ui: &mut egui::Ui, fonts: &[Row], dont_show: &mut bool) -> bool { ui.set_width(520.0); if fonts.is_empty() { ui.label(tl!("None of the fonts this document is missing can be downloaded free of charge from their publisher.")); - return crate::dialogs::close_button(ui); + ui.add_space(8.0); + return close_row(ui, |_| {}); } ui.label(tl!( "This document uses fonts that aren't installed, so it is shown in other fonts and may not look as it was written. These fonts can be downloaded free of charge:" @@ -152,14 +166,8 @@ pub(crate) fn body(app: &mut WordApp, ui: &mut egui::Ui, fonts: &[Row], dont_sho app.ui.font_download_notice = !*dont_show; } ui.add_space(8.0); - let mut close = ui.input(|i| i.key_pressed(egui::Key::Escape)); let mut add = false; - ui.horizontal(|ui| { - add = ui.button(tl!("Add Font…")).clicked(); - ui.with_layout(crate::rtl::far_side(ui, egui::Align::Center), |ui| { - close |= ui.add(crate::widgets::primary_button(ui, tl!("Close"))).clicked(); - }); - }); + let close = close_row(ui, |ui| add = ui.button(tl!("Add Font…")).clicked()); if add { // The file picker replaces the box; the added font lays the document out again. let _ = app.run("font.add", serde_json::json!({}));