diff --git a/rm-config/src/keymap/mod.rs b/rm-config/src/keymap/mod.rs index 8502b8f..3469305 100644 --- a/rm-config/src/keymap/mod.rs +++ b/rm-config/src/keymap/mod.rs @@ -367,7 +367,13 @@ impl KeymapConfig { } } - pub fn get_keys_for_action(&self, action: Action) -> Option { + pub fn get_keys_for_action_joined(&self, action: Action) -> Option { + let keys = self.get_keys_for_action(action)?; + + Some(keys.join("/")) + } + + pub fn get_keys_for_action(&self, action: Action) -> Option> { let mut keys = vec![]; for keybinding in &self.general.keybindings { @@ -390,8 +396,9 @@ impl KeymapConfig { if keys.is_empty() { None } else { - Some(keys.join("/")) + Some(keys) } + } fn populate_hashmap(&mut self) { diff --git a/rm-config/src/main_config/icons.rs b/rm-config/src/main_config/icons.rs index 39716ce..872f48f 100644 --- a/rm-config/src/main_config/icons.rs +++ b/rm-config/src/main_config/icons.rs @@ -123,7 +123,7 @@ fn default_disk() -> String { } fn default_help() -> String { - "󰘥".into() + "".into() } fn default_success() -> String { diff --git a/rm-main/src/tui/components/misc.rs b/rm-main/src/tui/components/misc.rs index 5197ddb..bda4f54 100644 --- a/rm-main/src/tui/components/misc.rs +++ b/rm-main/src/tui/components/misc.rs @@ -42,7 +42,6 @@ pub fn popup_rects(rect: Rect, percent_x: u16, percent_y: u16) -> (Rect, Rect, R pub fn keybinding_style() -> Style { Style::default() - .fg(CONFIG.general.accent_color) .underlined() .underline_color(CONFIG.general.accent_color) } diff --git a/rm-main/src/tui/tabs/search/bottom_bar.rs b/rm-main/src/tui/tabs/search/bottom_bar.rs index d6ba9cb..a7e7710 100644 --- a/rm-main/src/tui/tabs/search/bottom_bar.rs +++ b/rm-main/src/tui/tabs/search/bottom_bar.rs @@ -137,7 +137,7 @@ impl Component for SearchState { let append_key_info = |line: &mut Line| { let providers_key = CONFIG .keybindings - .get_keys_for_action(Action::ShowProvidersInfo); + .get_keys_for_action_joined(Action::ShowProvidersInfo); if let Some(key) = providers_key { line.push_span(Span::raw("Press ")); line.push_span(Span::styled(key, keybinding_style())); diff --git a/rm-main/src/tui/tabs/torrents/popups/details.rs b/rm-main/src/tui/tabs/torrents/popups/details.rs index 66ebe0b..016964e 100644 --- a/rm-main/src/tui/tabs/torrents/popups/details.rs +++ b/rm-main/src/tui/tabs/torrents/popups/details.rs @@ -86,7 +86,7 @@ impl Component for DetailsPopup { show_files_line.push_span(Span::styled( CONFIG .keybindings - .get_keys_for_action(Action::ShowFiles) + .get_keys_for_action_joined(Action::ShowFiles) .unwrap_or_default(), keybinding_style(), )); @@ -96,7 +96,7 @@ impl Component for DetailsPopup { move_location_line.push_span(Span::styled( CONFIG .keybindings - .get_keys_for_action(Action::MoveTorrent) + .get_keys_for_action_joined(Action::MoveTorrent) .unwrap_or_default(), keybinding_style(), )); @@ -106,7 +106,7 @@ impl Component for DetailsPopup { delete_line.push_span(Span::styled( CONFIG .keybindings - .get_keys_for_action(Action::Delete) + .get_keys_for_action_joined(Action::Delete) .unwrap_or_default(), keybinding_style(), )); @@ -116,7 +116,7 @@ impl Component for DetailsPopup { change_category_line.push_span(Span::styled( CONFIG .keybindings - .get_keys_for_action(Action::ChangeCategory) + .get_keys_for_action_joined(Action::ChangeCategory) .unwrap_or_default(), keybinding_style(), )); diff --git a/rm-main/src/tui/tabs/torrents/popups/files.rs b/rm-main/src/tui/tabs/torrents/popups/files.rs index 6e843e1..bdbfc86 100644 --- a/rm-main/src/tui/tabs/torrents/popups/files.rs +++ b/rm-main/src/tui/tabs/torrents/popups/files.rs @@ -285,13 +285,13 @@ impl Component for FilesPopup { if CONFIG.general.beginner_mode { let mut keys = vec![]; - if let Some(key) = CONFIG.keybindings.get_keys_for_action(Action::Select) { + if let Some(key) = CONFIG.keybindings.get_keys_for_action_joined(Action::Select) { keys.push(Span::raw(" ")); keys.push(Span::styled(key, keybinding_style())); keys.push(Span::raw(" - toggle | ")); } - if let Some(key) = CONFIG.keybindings.get_keys_for_action(Action::XdgOpen) { + if let Some(key) = CONFIG.keybindings.get_keys_for_action_joined(Action::XdgOpen) { keys.push(Span::styled(key, keybinding_style())); keys.push(Span::raw(" - xdg_open ")); } diff --git a/rm-main/src/tui/tabs/torrents/tasks/default.rs b/rm-main/src/tui/tabs/torrents/tasks/default.rs index 403cf68..0af668c 100644 --- a/rm-main/src/tui/tabs/torrents/tasks/default.rs +++ b/rm-main/src/tui/tabs/torrents/tasks/default.rs @@ -19,12 +19,18 @@ impl Component for Default { if CONFIG.general.beginner_mode { if let Some(keys) = CONFIG.keybindings.get_keys_for_action(Action::ShowHelp) { + line.push_span(Span::raw(format!("{} ", CONFIG.icons.help))); line_is_empty = false; - line.push_span(Span::raw(format!("{} ", CONFIG.icons.help))); - line.push_span(Span::styled(keys, keybinding_style())); + let keys_len = keys.len(); + for (idx, key) in keys.into_iter().enumerate() { + line.push_span(Span::styled(key, keybinding_style())); + if idx != keys_len - 1 { + line.push_span(Span::raw(" / ")); + } + } line.push_span(Span::raw(" - help")); } - if let Some(keys) = CONFIG.keybindings.get_keys_for_action(Action::Confirm) { + if let Some(keys) = CONFIG.keybindings.get_keys_for_action_joined(Action::Confirm) { if !line_is_empty { line.push_span(Span::raw(" | ")); } else { diff --git a/rm-main/src/tui/tabs/torrents/tasks/selection.rs b/rm-main/src/tui/tabs/torrents/tasks/selection.rs index 003eaf0..8fbf523 100644 --- a/rm-main/src/tui/tabs/torrents/tasks/selection.rs +++ b/rm-main/src/tui/tabs/torrents/tasks/selection.rs @@ -19,7 +19,7 @@ impl Component for Selection { let mut line = Line::default(); let mut line_is_empty = true; - if let Some(keys) = CONFIG.keybindings.get_keys_for_action(Action::Close) { + if let Some(keys) = CONFIG.keybindings.get_keys_for_action_joined(Action::Close) { line_is_empty = false; line.push_span(Span::styled(keys, keybinding_style())); line.push_span(Span::raw(" - clear selection")); diff --git a/rm-main/src/tui/tabs/torrents/tasks/sort.rs b/rm-main/src/tui/tabs/torrents/tasks/sort.rs index 68bc261..382014a 100644 --- a/rm-main/src/tui/tabs/torrents/tasks/sort.rs +++ b/rm-main/src/tui/tabs/torrents/tasks/sort.rs @@ -18,13 +18,13 @@ impl Component for Sort { let mut line = Line::default(); let mut line_is_empty = true; - if let Some(keys) = CONFIG.keybindings.get_keys_for_action(Action::Close) { + if let Some(keys) = CONFIG.keybindings.get_keys_for_action_joined(Action::Close) { line_is_empty = false; line.push_span(Span::styled(keys, keybinding_style())); line.push_span(Span::raw(" - reset & exit")); } - if let Some(keys) = CONFIG.keybindings.get_keys_for_action(Action::Confirm) { + if let Some(keys) = CONFIG.keybindings.get_keys_for_action_joined(Action::Confirm) { if !line_is_empty { line.push_span(Span::raw(" | ")); } @@ -33,7 +33,7 @@ impl Component for Sort { line.push_span(Span::raw(" - apply")); } - if let Some(keys) = CONFIG.keybindings.get_keys_for_action(Action::Down) { + if let Some(keys) = CONFIG.keybindings.get_keys_for_action_joined(Action::Down) { if !line_is_empty { line.push_span(Span::raw(" | ")); }