diff --git a/src/components/command.rs b/src/components/command.rs index 0f34c994..5f855f20 100644 --- a/src/components/command.rs +++ b/src/components/command.rs @@ -1,5 +1,5 @@ /// -#[derive(Copy, Clone)] +#[derive(Copy, Clone, PartialEq, PartialOrd, Ord, Eq)] pub struct CommandText { /// pub name: &'static str, diff --git a/src/components/help.rs b/src/components/help.rs index 869257dd..75e32e5e 100644 --- a/src/components/help.rs +++ b/src/components/help.rs @@ -127,6 +127,8 @@ impl HelpComponent { /// pub fn set_cmds(&mut self, cmds: Vec) { self.cmds = cmds; + self.cmds.sort_by_key(|e| e.text); + self.cmds.dedup_by_key(|e| e.text); self.cmds.sort_by_key(|e| hash(&e.text.group)); } @@ -162,6 +164,7 @@ impl HelpComponent { txt.extend( group .into_iter() + .sorted_by_key(|e| e.order) .map(|e| { let is_selected = self.selection == processed; if is_selected { diff --git a/src/strings.rs b/src/strings.rs index b637090e..98d7b6b2 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -35,7 +35,7 @@ pub mod commands { /// pub static CLOSE_POPUP: CommandText = CommandText::new( "Close [esc]", - "close popup", + "close overlay (e.g commit, help)", CMD_GROUP_GENERAL, ); /// @@ -90,7 +90,7 @@ pub mod commands { pub static STATUS_FOCUS_RIGHT: CommandText = CommandText::new( "Diff [\u{2192}]", //→ "inspect file diff", - CMD_GROUP_GENERAL, + CMD_GROUP_CHANGES, ); /// pub static QUIT: CommandText = CommandText::new(