summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2023-08-12 16:28:22 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2023-08-12 16:28:22 -0400
commit82e231ac004e1f25f0a447bc601e5e3a10dca4d2 (patch)
tree6f646e653189d81db0284592a3a07bea5e632d08
parente6f0d5ce01a296715d0d52755a71068a88a8bf1f (diff)
show description in help menu as well
-rw-r--r--src/config/keymap/keymapping.rs2
-rw-r--r--src/ui/widgets/tui_help.rs11
2 files changed, 9 insertions, 4 deletions
diff --git a/src/config/keymap/keymapping.rs b/src/config/keymap/keymapping.rs
index 6bccc2a..0b3e122 100644
--- a/src/config/keymap/keymapping.rs
+++ b/src/config/keymap/keymapping.rs
@@ -141,7 +141,7 @@ fn insert_keycommand(
Entry::Occupied(_) => return Err(KeymapError::Conflict),
Entry::Vacant(entry) => entry.insert(CommandKeybind::SimpleKeybind {
command: keycommand,
- description: description,
+ description,
}),
};
return Ok(());
diff --git a/src/ui/widgets/tui_help.rs b/src/ui/widgets/tui_help.rs
index 7616d09..84f0c3d 100644
--- a/src/ui/widgets/tui_help.rs
+++ b/src/ui/widgets/tui_help.rs
@@ -124,9 +124,14 @@ pub fn get_raw_keymap_table<'a>(
for (event, bind) in keymap.iter() {
let key = key_event_to_string(event);
let (command, comment) = match bind {
- CommandKeybind::SimpleKeybind { command, .. } => {
- (format!("{}", command), command.comment())
- }
+ CommandKeybind::SimpleKeybind {
+ command,
+ description: None,
+ } => (format!("{}", command), command.comment()),
+ CommandKeybind::SimpleKeybind {
+ command,
+ description: Some(desc),
+ } => (format!("{}", command), desc.as_str()),
CommandKeybind::CompositeKeybind(sub_keymap) => {
let mut sub_rows = get_raw_keymap_table(sub_keymap, "", sort_by);
for _ in 0..sub_rows.len() {