mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 03:25:23 +00:00
fix(results): remove keymap hint if help is disabled
This commit is contained in:
parent
a602dda347
commit
f30871afe4
@ -6,11 +6,13 @@ use super::themes::DEFAULT_THEME;
|
|||||||
|
|
||||||
const DEFAULT_UI_SCALE: u16 = 100;
|
const DEFAULT_UI_SCALE: u16 = 100;
|
||||||
|
|
||||||
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Hash)]
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Hash)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct UiConfig {
|
pub struct UiConfig {
|
||||||
pub use_nerd_font_icons: bool,
|
pub use_nerd_font_icons: bool,
|
||||||
pub ui_scale: u16,
|
pub ui_scale: u16,
|
||||||
|
pub no_help: bool,
|
||||||
pub show_help_bar: bool,
|
pub show_help_bar: bool,
|
||||||
pub show_preview_panel: bool,
|
pub show_preview_panel: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
@ -25,6 +27,7 @@ impl Default for UiConfig {
|
|||||||
Self {
|
Self {
|
||||||
use_nerd_font_icons: false,
|
use_nerd_font_icons: false,
|
||||||
ui_scale: DEFAULT_UI_SCALE,
|
ui_scale: DEFAULT_UI_SCALE,
|
||||||
|
no_help: false,
|
||||||
show_help_bar: false,
|
show_help_bar: false,
|
||||||
show_preview_panel: true,
|
show_preview_panel: true,
|
||||||
input_bar_position: InputPosition::Top,
|
input_bar_position: InputPosition::Top,
|
||||||
|
@ -225,6 +225,7 @@ pub fn draw(ctx: &Ctx, f: &mut Frame<'_>, area: Rect) -> Result<Layout> {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
// only show the preview keybinding hint if there's actually something to preview
|
// only show the preview keybinding hint if there's actually something to preview
|
||||||
ctx.tv_state.preview_state.enabled,
|
ctx.tv_state.preview_state.enabled,
|
||||||
|
ctx.config.ui.no_help,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// input box
|
// input box
|
||||||
|
@ -253,8 +253,12 @@ pub fn draw_results_list(
|
|||||||
help_keybinding: &str,
|
help_keybinding: &str,
|
||||||
preview_keybinding: &str,
|
preview_keybinding: &str,
|
||||||
preview_togglable: bool,
|
preview_togglable: bool,
|
||||||
|
no_help: bool,
|
||||||
) -> Result<()> {
|
) -> 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 {
|
if preview_togglable {
|
||||||
toggle_hints.push_str(&format!(" preview: <{preview_keybinding}> ",));
|
toggle_hints.push_str(&format!(" preview: <{preview_keybinding}> ",));
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,7 @@ impl Television {
|
|||||||
|
|
||||||
if no_help {
|
if no_help {
|
||||||
config.ui.show_help_bar = false;
|
config.ui.show_help_bar = false;
|
||||||
|
config.ui.no_help = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let matching_mode = if exact {
|
let matching_mode = if exact {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user