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 {
366
         self.renderer.fill_rect(backdrop, gartk_core::Color::new(0.0, 0.0, 0.0, 0.75))?;
366
         self.renderer.fill_rect(backdrop, gartk_core::Color::new(0.0, 0.0, 0.0, 0.75))?;
367
 
367
 
368
         // Help box dimensions
368
         // Help box dimensions
369
-        let box_width = 340u32;
369
+        let box_width = 320u32;
370
-        let box_height = 380u32;
370
+        let box_height = 360u32;
371
         let box_x = (self.width.saturating_sub(box_width)) / 2;
371
         let box_x = (self.width.saturating_sub(box_width)) / 2;
372
         let box_y = (self.height.saturating_sub(box_height)) / 2;
372
         let box_y = (self.height.saturating_sub(box_height)) / 2;
373
 
373
 
@@ -382,56 +382,60 @@ impl App {
382
             color: self.theme.text,
382
             color: self.theme.text,
383
             ..Default::default()
383
             ..Default::default()
384
         };
384
         };
385
-        let x = box_x as f64 + 20.0;
385
+        let x = box_x as f64 + 16.0;
386
-        let mut y = box_y as f64 + 24.0;
386
+        let mut y = box_y as f64 + 20.0;
387
         self.renderer.text("Keyboard Shortcuts", x, y, &title_style)?;
387
         self.renderer.text("Keyboard Shortcuts", x, y, &title_style)?;
388
 
388
 
389
         // Separator
389
         // Separator
390
-        y += 24.0;
390
+        y += 22.0;
391
-        self.renderer.line(x, y, x + box_width as f64 - 40.0, y, self.theme.border, 1.0)?;
391
+        self.renderer.line(x, y, x + box_width as f64 - 32.0, y, self.theme.border, 1.0)?;
392
-        y += 16.0;
392
+        y += 12.0;
393
 
393
 
394
         // Keybindings
394
         // Keybindings
395
         let key_style = TextStyle {
395
         let key_style = TextStyle {
396
             font_family: "monospace".to_string(),
396
             font_family: "monospace".to_string(),
397
-            font_size: 11.0,
397
+            font_size: 10.0,
398
             color: self.theme.cpu_color,
398
             color: self.theme.cpu_color,
399
             ..Default::default()
399
             ..Default::default()
400
         };
400
         };
401
         let desc_style = TextStyle {
401
         let desc_style = TextStyle {
402
             font_family: "monospace".to_string(),
402
             font_family: "monospace".to_string(),
403
-            font_size: 11.0,
403
+            font_size: 10.0,
404
             color: self.theme.text_secondary,
404
             color: self.theme.text_secondary,
405
             ..Default::default()
405
             ..Default::default()
406
         };
406
         };
407
 
407
 
408
+        // Column offset for descriptions
409
+        let desc_x = x + 90.0;
410
+
408
         let bindings = [
411
         let bindings = [
409
             ("?", "Toggle this help"),
412
             ("?", "Toggle this help"),
410
-            ("q / Esc", "Quit (Esc clears search first)"),
413
+            ("q / Esc", "Quit / clear search"),
411
             ("", ""),
414
             ("", ""),
412
-            ("1-4", "Switch to tab (CPU/Mem/Net/Disk)"),
415
+            ("1-4", "Switch tab"),
413
-            ("Tab", "Cycle through tabs"),
416
+            ("Tab", "Cycle tabs"),
414
             ("", ""),
417
             ("", ""),
415
-            ("j / \u{2193}", "Select next process"),
418
+            ("j / \u{2193}", "Next process"),
416
-            ("k / \u{2191}", "Select previous process"),
419
+            ("k / \u{2191}", "Previous process"),
417
-            ("Home / End", "Jump to first / last"),
420
+            ("Home", "First process"),
418
-            ("PgUp / PgDn", "Jump 10 rows"),
421
+            ("End", "Last process"),
422
+            ("PgUp/PgDn", "Jump 10 rows"),
419
             ("", ""),
423
             ("", ""),
420
-            ("f", "Freeze process list"),
424
+            ("f", "Freeze list"),
421
-            ("/", "Search / filter by name"),
425
+            ("/", "Search by name"),
422
             ("", ""),
426
             ("", ""),
423
-            ("K", "Kill selected (SIGTERM)"),
427
+            ("K", "Kill (SIGTERM)"),
424
-            ("X", "Force kill (SIGKILL)"),
428
+            ("X", "Kill (SIGKILL)"),
425
-            ("r", "Force refresh"),
429
+            ("r", "Refresh"),
426
         ];
430
         ];
427
 
431
 
428
         for (key, desc) in bindings {
432
         for (key, desc) in bindings {
429
             if key.is_empty() {
433
             if key.is_empty() {
430
-                y += 8.0; // Spacer
434
+                y += 6.0; // Spacer
431
             } else {
435
             } else {
432
                 self.renderer.text(key, x, y, &key_style)?;
436
                 self.renderer.text(key, x, y, &key_style)?;
433
-                self.renderer.text(desc, x + 100.0, y, &desc_style)?;
437
+                self.renderer.text(desc, desc_x, y, &desc_style)?;
434
-                y += 18.0;
438
+                y += 16.0;
435
             }
439
             }
436
         }
440
         }
437
 
441