steamline some more command functions

This commit is contained in:
Stephan Dilly 2020-06-25 19:05:59 +02:00
parent df338334e1
commit 8627d940f4
3 changed files with 39 additions and 44 deletions

View file

@ -99,26 +99,22 @@ impl Component for HelpComponent {
out.clear();
}
out.push(
CommandInfo::new(
commands::HELP_OPEN,
if self.visible {
out.push(CommandInfo::new(commands::SCROLL, true, true));
out.push(CommandInfo::new(
commands::CLOSE_POPUP,
true,
!self.visible,
)
.order(99),
);
true,
));
}
out.push(CommandInfo::new(
commands::SCROLL,
true,
self.visible,
));
out.push(CommandInfo::new(
commands::CLOSE_POPUP,
true,
self.visible,
));
if !self.visible || force_all {
out.push(
CommandInfo::new(commands::HELP_OPEN, true, true)
.order(99),
);
}
visibility_blocking(self)
}

View file

@ -75,28 +75,24 @@ impl Component for InspectCommitComponent {
force_all,
self.components().as_slice(),
);
}
out.push(
CommandInfo::new(
commands::CLOSE_POPUP,
out.push(
CommandInfo::new(commands::CLOSE_POPUP, true, true)
.order(1),
);
out.push(CommandInfo::new(
commands::DIFF_FOCUS_RIGHT,
self.can_focus_diff(),
!self.diff.focused() || force_all,
));
out.push(CommandInfo::new(
commands::DIFF_FOCUS_LEFT,
true,
self.is_visible(),
)
.order(1),
);
out.push(CommandInfo::new(
commands::DIFF_FOCUS_RIGHT,
self.can_focus_diff(),
(self.is_visible() && !self.diff.focused()) || force_all,
));
out.push(CommandInfo::new(
commands::DIFF_FOCUS_LEFT,
true,
(self.is_visible() && self.diff.focused()) || force_all,
));
self.diff.focused() || force_all,
));
}
visibility_blocking(self)
}

View file

@ -38,13 +38,16 @@ impl Component for StashMsgComponent {
out: &mut Vec<CommandInfo>,
force_all: bool,
) -> CommandBlocking {
self.input.commands(out, force_all);
if self.is_visible() || force_all {
self.input.commands(out, force_all);
out.push(CommandInfo::new(
commands::STASHING_CONFIRM_MSG,
true,
true,
));
}
out.push(CommandInfo::new(
commands::STASHING_CONFIRM_MSG,
true,
self.is_visible() || force_all,
));
visibility_blocking(self)
}