gardesk/garfield / 9ef2e3a

Browse files

dialog: increase size, fix text wrapping, prevent button clipping

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
9ef2e3a817a12cf924a3de00dfab2073474d51b7
Parents
ac9a84b
Tree
a7e3096

1 changed file

StatusFile+-
M garfield/src/ui/dialog.rs 11 11
garfield/src/ui/dialog.rsmodified
@@ -169,10 +169,10 @@ impl ConfirmDialog {
169169
     /// Get the dialog rectangle (centered in bounds).
170170
     fn dialog_rect(&self) -> Rect {
171171
         // Calculate width based on message length, with min/max constraints
172
-        let base_width = 450;
173
-        let dialog_width = base_width.min(self.bounds.width.saturating_sub(40));
174
-        // Need enough height for: title (30) + message (~60) + gap (20) + buttons (32) + padding (40)
175
-        let dialog_height = 220.min(self.bounds.height.saturating_sub(20));
172
+        let base_width = 480;
173
+        let dialog_width = base_width.min(self.bounds.width.saturating_sub(20));
174
+        // Need enough height for: title (40) + message (~80) + gap (20) + buttons (32) + padding (48)
175
+        let dialog_height = 240.min(self.bounds.height.saturating_sub(20));
176176
         let x = self.bounds.x + (self.bounds.width as i32 - dialog_width as i32) / 2;
177177
         let y = self.bounds.y + (self.bounds.height as i32 - dialog_height as i32) / 2;
178178
         Rect::new(x, y, dialog_width, dialog_height)
@@ -215,9 +215,9 @@ impl ConfirmDialog {
215215
     fn button_rects(&self) -> (Rect, Rect) {
216216
         let dialog = self.dialog_rect();
217217
         let button_width = 100;
218
-        let button_height = 32;
219
-        // Position buttons 20px from bottom for more breathing room
220
-        let button_y = dialog.y + dialog.height as i32 - button_height as i32 - 20;
218
+        let button_height = 36;
219
+        // Position buttons 24px from bottom for more breathing room
220
+        let button_y = dialog.y + dialog.height as i32 - button_height as i32 - 24;
221221
         let button_gap = 16;
222222
         let total_width = button_width * 2 + button_gap;
223223
         let start_x = dialog.x + (dialog.width as i32 - total_width as i32) / 2;
@@ -264,10 +264,10 @@ impl ConfirmDialog {
264264
             .font_size(theme.font_size)
265265
             .color(theme.item_foreground);
266266
 
267
-        // Wrap and render message lines
268
-        let max_chars = ((dialog_rect.width - 40) as f64 / (theme.font_size * 0.6)) as usize;
269
-        let wrapped_lines = Self::wrap_text(&self.message, max_chars.max(30));
270
-        let mut y = dialog_rect.y + 52;
267
+        // Wrap and render message lines (use conservative char width estimate)
268
+        let max_chars = ((dialog_rect.width - 50) as f64 / (theme.font_size * 0.55)) as usize;
269
+        let wrapped_lines = Self::wrap_text(&self.message, max_chars.max(25));
270
+        let mut y = dialog_rect.y + 56;
271271
         for line in wrapped_lines {
272272
             renderer.text(
273273
                 &line,