From 46a2a3a52b837512280384d7b03e4718e504b4a6 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Sat, 3 Sep 2022 04:04:03 -0400 Subject: [PATCH] other: Clarify help menu (#800) * other: clarify that numbers are for help menu * bug: fix incorrect overscroll check, should be min --- src/canvas.rs | 6 +++--- src/canvas/dialogs/help_dialog.rs | 4 ++-- src/constants.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/canvas.rs b/src/canvas.rs index 3a3549a2..4a834ae4 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -333,9 +333,9 @@ impl Painter { ] } else { [ - Constraint::Percentage(20), - Constraint::Percentage(60), - Constraint::Percentage(20), + Constraint::Percentage(15), + Constraint::Percentage(70), + Constraint::Percentage(15), ] }) .split(vertical_dialog_chunk[1]); diff --git a/src/canvas/dialogs/help_dialog.rs b/src/canvas/dialogs/help_dialog.rs index b125e73f..c315bc8c 100644 --- a/src/canvas/dialogs/help_dialog.rs +++ b/src/canvas/dialogs/help_dialog.rs @@ -1,4 +1,4 @@ -use std::cmp::max; +use std::cmp::{max, min}; use unicode_width::UnicodeWidthStr; @@ -88,7 +88,7 @@ impl Painter { .scroll_state .current_scroll_index; - *index = max(*index, *max_scroll_index); + *index = min(*index, *max_scroll_index); } f.render_widget( diff --git a/src/constants.rs b/src/constants.rs index a10b766b..0d073423 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -219,7 +219,7 @@ pub static NORD_LIGHT_COLOUR_PALETTE: Lazy = Lazy::new(|| ConfigC // Help text pub const HELP_CONTENTS_TEXT: [&str; 8] = [ - "Press the corresponding numbers to jump to the section, or scroll:", + "Either scroll or press the number key to go to the corresponding help menu section:", "1 - General", "2 - CPU widget", "3 - Process widget",