From 23ef9bf02c092bda9768f72794483f5b74daf0a2 Mon Sep 17 00:00:00 2001 From: Philippe GRABARSKY Date: Mon, 23 Feb 2026 16:43:35 +0100 Subject: [PATCH] Make the help view more compact --- docs/gui.md | 12 +-- src/help.rs | 162 ++++++++++++++++----------------- src/history_view_container.rs | 2 +- src/list_indicator_view.rs | 2 +- src/shortcut_view_container.rs | 2 +- 5 files changed, 85 insertions(+), 95 deletions(-) diff --git a/docs/gui.md b/docs/gui.md index 8960c2a..c3fbbe1 100644 --- a/docs/gui.md +++ b/docs/gui.md @@ -39,11 +39,11 @@ There are three main views: 1. *Help view*: Shows available commands. -Use Tab to switch between the first two views, and Ctrl+h for help. +Use Tab to switch between the first two views, and ^h for help. * Enter: Go to selected directory -* Esc or Ctrl+q: Exit and stay in the current directory +* Esc or ^q: Exit and stay in the current directory * Up/Down: Select directory (Shift for bigger jumps) @@ -51,13 +51,13 @@ Use Tab to switch between the first two views, and Ctrl+h * Home: Go to most recent directory (the top) -* Ctrl+a: Show full directory path (the full path is shown instead of the shortcut names), or switch back to shortcut usage. +* ^a: Show full directory path (the full path is shown instead of the shortcut names), or switch back to shortcut usage. -* Ctrl+d: Delete selected entry +* ^d: Delete selected entry -* Ctrl+e (shortcuts view): Edit description +* ^e (shortcuts view): Edit description -* Ctrl+f Switch between exact and fuzzy search +* ^f Switch between exact and fuzzy search * F12: Open the configuration view diff --git a/src/help.rs b/src/help.rs index 4ed0bbd..b653c1d 100644 --- a/src/help.rs +++ b/src/help.rs @@ -40,13 +40,13 @@ impl View for Help { let layout = Layout::vertical([ Constraint::Fill(1), - Constraint::Length(19), + Constraint::Length(18), Constraint::Fill(1), ]); let chunks: [Rect; 3] = layout.areas(modal_area); let center_layout = Layout::horizontal([ Constraint::Fill(1), - Constraint::Length(100), + Constraint::Length(74), Constraint::Fill(1), ]); let chunks: [Rect; 3] = center_layout.areas(chunks[1]); @@ -59,90 +59,80 @@ impl View for Help { let es = styles.text_em_style; let message = Paragraph::new(vec![ - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("tab", es), - Span::styled(" to switch between the views.", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("enter", es), - Span::styled(" to exit the GUI and go into the selected directory;", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("esc or ctrl+q", es), - Span::styled(" to simply exit and stay in the current directory.", ts), - ]), - Line::from(vec![ - Span::styled("Use the ", ts), - Span::styled("up", es), - Span::styled(" and ", ts), - Span::styled("down", es), - Span::styled(" arrow keys to select a directory (", ts), - Span::styled("shift", es), - Span::styled(" for bigger jumps);", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("page up", es), - Span::styled(" and ", ts), - Span::styled("page down", es), - Span::styled(" to scroll through the list by page;", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("home", es), - Span::styled( - " to go to the most recent directory in the history (the top);", - ts, - ), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("ctrl+a", es), - Span::styled(" to see the full directory path without shortcuts, or switch back to shortcut usage.", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("ctrl+d", es), - Span::styled(" to delete the selected entry.", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("ctrl+e", es), - Span::styled(" to edit a shortcut description.", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("ctrl+f", es), - Span::styled(" to switch between exact and fuzzy search.", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("ctrl+h", es), - Span::styled(" for the help screen.", ts), - ]), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("F12", es), - Span::styled(" to open the configuration view.", ts), - ]), - Line::from(""), - Line::from(vec![Span::styled("Enter a text to filter.", ts)]), - Line::from(""), - Line::from(vec![ - Span::styled("Use ", ts), - Span::styled("esc", es), - Span::styled(" to close this window.", ts), - ]), - ]) - .block( - Block::default() - .padding(Padding::new(1, 1, 1, 1)) - .title(Span::styled(" cdir help ", styles.title_style)) - .borders(Borders::ALL) - ); + Line::from(vec![ + Span::styled("tab", es), + Span::styled(" to switch between the views.", ts), + ]), + Line::from(vec![ + Span::styled("enter", es), + Span::styled(" to exit the GUI and go into the selected directory.", ts), + ]), + Line::from(vec![ + Span::styled("esc or ^+q", es), + Span::styled(" to simply exit and stay in the current directory.", ts), + ]), + Line::from(vec![ + Span::styled("up", es), + Span::styled(" and ", ts), + Span::styled("down", es), + Span::styled(" arrow keys to select a directory (", ts), + Span::styled("shift", es), + Span::styled(" for bigger jumps).", ts), + ]), + Line::from(vec![ + Span::styled("page up", es), + Span::styled(" and ", ts), + Span::styled("page down", es), + Span::styled(" to scroll through the list by page.", ts), + ]), + Line::from(vec![ + Span::styled("home", es), + Span::styled( + " to go to the most recent directory in the history (the top).", + ts, + ), + ]), + Line::from(vec![ + Span::styled("^a", es), + Span::styled( + " to switch between full directory path and shortcuts usage.", + ts, + ), + ]), + Line::from(vec![ + Span::styled("^d", es), + Span::styled(" to delete the selected entry.", ts), + ]), + Line::from(vec![ + Span::styled("^e", es), + Span::styled(" to edit a shortcut description.", ts), + ]), + Line::from(vec![ + Span::styled("^f", es), + Span::styled(" to switch between exact and fuzzy search.", ts), + ]), + Line::from(vec![ + Span::styled("^h", es), + Span::styled(" for the help screen.", ts), + ]), + Line::from(vec![ + Span::styled("F12", es), + Span::styled(" to open the configuration view.", ts), + ]), + Line::from(""), + Line::from(vec![Span::styled("Enter a text to filter.", ts)]), + Line::from(""), + Line::from(vec![ + Span::styled("esc", es), + Span::styled(" to close this window.", ts), + ]), + ]) + .block( + Block::default() + .padding(Padding::new(1, 1, 1, 1)) + .title(Span::styled(" cdir help ", styles.title_style)) + .borders(Borders::ALL), + ); // Fill the frame with the background color if defined if let Some(bg_color) = &styles.background_color { diff --git a/src/history_view_container.rs b/src/history_view_container.rs index 293dd1a..df4f942 100644 --- a/src/history_view_container.rs +++ b/src/history_view_container.rs @@ -85,7 +85,7 @@ impl View for HistoryViewContainer { let horizontal = Layout::horizontal([ Constraint::Fill(1), - Constraint::Length(14), + Constraint::Length(10), Constraint::Length(1), Constraint::Length(12), ]) diff --git a/src/list_indicator_view.rs b/src/list_indicator_view.rs index 0ea8ab3..a26e692 100644 --- a/src/list_indicator_view.rs +++ b/src/list_indicator_view.rs @@ -73,7 +73,7 @@ impl View for ListIndicatorView { .bg(Color::Red) .alignment(Alignment::Center) } else { - Paragraph::new("ctrl+h: help") + Paragraph::new("^h: help") .style( Style::default() .bg(config_lock.styles.header_bg_color.unwrap()) diff --git a/src/shortcut_view_container.rs b/src/shortcut_view_container.rs index 5f51f06..f02d39b 100644 --- a/src/shortcut_view_container.rs +++ b/src/shortcut_view_container.rs @@ -85,7 +85,7 @@ impl View for ShortcutViewContainer { let horizontal = Layout::horizontal([ Constraint::Fill(1), - Constraint::Length(14), + Constraint::Length(10), Constraint::Length(1), Constraint::Length(12), ])