show cmds in new commit popup

This commit is contained in:
Stephan Dilly 2020-06-09 16:58:28 +02:00
parent 702415c40d
commit 6a6fae9581
4 changed files with 21 additions and 11 deletions

View File

@ -201,10 +201,9 @@ impl App {
self.revlog.update_git(ev)?;
self.inspect_commit_popup.update_git(ev)?;
if let AsyncNotification::Status = ev {
//TODO: is that needed?
self.update_commands()
}
//TODO: better system for this
// can we simply process the queue here and everyone just uses the queue to schedule a cmd update?
self.update_commands();
Ok(())
}

View File

@ -83,6 +83,18 @@ impl Component for InspectCommitComponent {
.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,
));
visibility_blocking(self)
}

View File

@ -183,18 +183,17 @@ pub mod commands {
"Add file or path to .gitignore",
CMD_GROUP_CHANGES,
);
///
pub static STATUS_FOCUS_LEFT: CommandText = CommandText::new(
pub static DIFF_FOCUS_LEFT: CommandText = CommandText::new(
"Back [\u{2190}]", //←
"view staged changes",
"view and select changed files",
CMD_GROUP_GENERAL,
);
///
pub static STATUS_FOCUS_RIGHT: CommandText = CommandText::new(
pub static DIFF_FOCUS_RIGHT: CommandText = CommandText::new(
"Diff [\u{2192}]", //→
"inspect file diff",
CMD_GROUP_CHANGES,
CMD_GROUP_GENERAL,
);
///
pub static QUIT: CommandText = CommandText::new(

View File

@ -298,12 +298,12 @@ impl Component for Status {
{
let focus_on_diff = self.focus == Focus::Diff;
out.push(CommandInfo::new(
commands::STATUS_FOCUS_LEFT,
commands::DIFF_FOCUS_LEFT,
true,
(self.visible && focus_on_diff) || force_all,
));
out.push(CommandInfo::new(
commands::STATUS_FOCUS_RIGHT,
commands::DIFF_FOCUS_RIGHT,
self.can_focus_diff(),
(self.visible && !focus_on_diff) || force_all,
));