mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-23 20:52:54 +03:00
better help sorting
This commit is contained in:
parent
6001593a0a
commit
448b6927c3
@ -1,5 +1,5 @@
|
||||
///
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, PartialEq, PartialOrd, Ord, Eq)]
|
||||
pub struct CommandText {
|
||||
///
|
||||
pub name: &'static str,
|
||||
|
@ -127,6 +127,8 @@ impl HelpComponent {
|
||||
///
|
||||
pub fn set_cmds(&mut self, cmds: Vec<CommandInfo>) {
|
||||
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 {
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user