fix(results): remove keymap hint if help is disabled (#480)

fixes #471
This commit is contained in:
nkxxll 2025-04-26 02:09:49 +02:00 committed by GitHub
parent a602dda347
commit 1f0c178a2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 1 deletions

View File

@ -6,11 +6,13 @@ use super::themes::DEFAULT_THEME;
const DEFAULT_UI_SCALE: u16 = 100;
#[allow(clippy::struct_excessive_bools)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Hash)]
#[serde(default)]
pub struct UiConfig {
pub use_nerd_font_icons: bool,
pub ui_scale: u16,
pub no_help: bool,
pub show_help_bar: bool,
pub show_preview_panel: bool,
#[serde(default)]
@ -25,6 +27,7 @@ impl Default for UiConfig {
Self {
use_nerd_font_icons: false,
ui_scale: DEFAULT_UI_SCALE,
no_help: false,
show_help_bar: false,
show_preview_panel: true,
input_bar_position: InputPosition::Top,

View File

@ -225,6 +225,7 @@ pub fn draw(ctx: &Ctx, f: &mut Frame<'_>, area: Rect) -> Result<Layout> {
.to_string(),
// only show the preview keybinding hint if there's actually something to preview
ctx.tv_state.preview_state.enabled,
ctx.config.ui.no_help,
)?;
// input box

View File

@ -253,8 +253,12 @@ pub fn draw_results_list(
help_keybinding: &str,
preview_keybinding: &str,
preview_togglable: bool,
no_help: bool,
) -> Result<()> {
let mut toggle_hints = format!(" help: <{help_keybinding}> ",);
let mut toggle_hints = String::new();
if !no_help {
toggle_hints.push_str(&format!(" help: <{help_keybinding}> ",));
}
if preview_togglable {
toggle_hints.push_str(&format!(" preview: <{preview_keybinding}> ",));
}

View File

@ -109,6 +109,7 @@ impl Television {
if no_help {
config.ui.show_help_bar = false;
config.ui.no_help = true;
}
let matching_mode = if exact {