gardesk/gartop / a0dda54

Browse files

Fix help overlay text overflow with tighter layout

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
a0dda5483e26df6ffb48eb418d113347cccb5988
Parents
c74d73c
Tree
cfba200

1 changed file

StatusFile+-
M gartop/src/gui/app.rs 28 24
gartop/src/gui/app.rsmodified
@@ -366,8 +366,8 @@ impl App {
366366
         self.renderer.fill_rect(backdrop, gartk_core::Color::new(0.0, 0.0, 0.0, 0.75))?;
367367
 
368368
         // Help box dimensions
369
-        let box_width = 340u32;
370
-        let box_height = 380u32;
369
+        let box_width = 320u32;
370
+        let box_height = 360u32;
371371
         let box_x = (self.width.saturating_sub(box_width)) / 2;
372372
         let box_y = (self.height.saturating_sub(box_height)) / 2;
373373
 
@@ -382,56 +382,60 @@ impl App {
382382
             color: self.theme.text,
383383
             ..Default::default()
384384
         };
385
-        let x = box_x as f64 + 20.0;
386
-        let mut y = box_y as f64 + 24.0;
385
+        let x = box_x as f64 + 16.0;
386
+        let mut y = box_y as f64 + 20.0;
387387
         self.renderer.text("Keyboard Shortcuts", x, y, &title_style)?;
388388
 
389389
         // Separator
390
-        y += 24.0;
391
-        self.renderer.line(x, y, x + box_width as f64 - 40.0, y, self.theme.border, 1.0)?;
392
-        y += 16.0;
390
+        y += 22.0;
391
+        self.renderer.line(x, y, x + box_width as f64 - 32.0, y, self.theme.border, 1.0)?;
392
+        y += 12.0;
393393
 
394394
         // Keybindings
395395
         let key_style = TextStyle {
396396
             font_family: "monospace".to_string(),
397
-            font_size: 11.0,
397
+            font_size: 10.0,
398398
             color: self.theme.cpu_color,
399399
             ..Default::default()
400400
         };
401401
         let desc_style = TextStyle {
402402
             font_family: "monospace".to_string(),
403
-            font_size: 11.0,
403
+            font_size: 10.0,
404404
             color: self.theme.text_secondary,
405405
             ..Default::default()
406406
         };
407407
 
408
+        // Column offset for descriptions
409
+        let desc_x = x + 90.0;
410
+
408411
         let bindings = [
409412
             ("?", "Toggle this help"),
410
-            ("q / Esc", "Quit (Esc clears search first)"),
413
+            ("q / Esc", "Quit / clear search"),
411414
             ("", ""),
412
-            ("1-4", "Switch to tab (CPU/Mem/Net/Disk)"),
413
-            ("Tab", "Cycle through tabs"),
415
+            ("1-4", "Switch tab"),
416
+            ("Tab", "Cycle tabs"),
414417
             ("", ""),
415
-            ("j / \u{2193}", "Select next process"),
416
-            ("k / \u{2191}", "Select previous process"),
417
-            ("Home / End", "Jump to first / last"),
418
-            ("PgUp / PgDn", "Jump 10 rows"),
418
+            ("j / \u{2193}", "Next process"),
419
+            ("k / \u{2191}", "Previous process"),
420
+            ("Home", "First process"),
421
+            ("End", "Last process"),
422
+            ("PgUp/PgDn", "Jump 10 rows"),
419423
             ("", ""),
420
-            ("f", "Freeze process list"),
421
-            ("/", "Search / filter by name"),
424
+            ("f", "Freeze list"),
425
+            ("/", "Search by name"),
422426
             ("", ""),
423
-            ("K", "Kill selected (SIGTERM)"),
424
-            ("X", "Force kill (SIGKILL)"),
425
-            ("r", "Force refresh"),
427
+            ("K", "Kill (SIGTERM)"),
428
+            ("X", "Kill (SIGKILL)"),
429
+            ("r", "Refresh"),
426430
         ];
427431
 
428432
         for (key, desc) in bindings {
429433
             if key.is_empty() {
430
-                y += 8.0; // Spacer
434
+                y += 6.0; // Spacer
431435
             } else {
432436
                 self.renderer.text(key, x, y, &key_style)?;
433
-                self.renderer.text(desc, x + 100.0, y, &desc_style)?;
434
-                y += 18.0;
437
+                self.renderer.text(desc, desc_x, y, &desc_style)?;
438
+                y += 16.0;
435439
             }
436440
         }
437441