mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
stop status from adding commands when not active
This commit is contained in:
parent
dd49d68eab
commit
e73cdb67bc
1 changed files with 52 additions and 50 deletions
|
|
@ -246,59 +246,61 @@ impl Component for Status {
|
||||||
out: &mut Vec<CommandInfo>,
|
out: &mut Vec<CommandInfo>,
|
||||||
force_all: bool,
|
force_all: bool,
|
||||||
) -> CommandBlocking {
|
) -> CommandBlocking {
|
||||||
for c in self.components() {
|
if self.visible {
|
||||||
if c.commands(out, force_all)
|
for c in self.components() {
|
||||||
!= CommandBlocking::PassingOn
|
if c.commands(out, force_all)
|
||||||
&& !force_all
|
!= CommandBlocking::PassingOn
|
||||||
{
|
&& !force_all
|
||||||
break;
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
let focus_on_diff = self.focus == Focus::Diff;
|
||||||
|
out.push(CommandInfo::new(
|
||||||
|
commands::STATUS_FOCUS_LEFT,
|
||||||
|
true,
|
||||||
|
(self.visible && focus_on_diff) || force_all,
|
||||||
|
));
|
||||||
|
out.push(CommandInfo::new(
|
||||||
|
commands::STATUS_FOCUS_RIGHT,
|
||||||
|
self.can_focus_diff(),
|
||||||
|
(self.visible && !focus_on_diff) || force_all,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
out.push(
|
||||||
|
CommandInfo::new(
|
||||||
|
commands::SELECT_STATUS,
|
||||||
|
true,
|
||||||
|
(self.visible && self.focus == Focus::Diff)
|
||||||
|
|| force_all,
|
||||||
|
)
|
||||||
|
.hidden(),
|
||||||
|
);
|
||||||
|
|
||||||
|
out.push(
|
||||||
|
CommandInfo::new(
|
||||||
|
commands::SELECT_STAGING,
|
||||||
|
true,
|
||||||
|
(self.visible && self.focus == Focus::WorkDir)
|
||||||
|
|| force_all,
|
||||||
|
)
|
||||||
|
.order(-2),
|
||||||
|
);
|
||||||
|
|
||||||
|
out.push(
|
||||||
|
CommandInfo::new(
|
||||||
|
commands::SELECT_UNSTAGED,
|
||||||
|
true,
|
||||||
|
(self.visible && self.focus == Focus::Stage)
|
||||||
|
|| force_all,
|
||||||
|
)
|
||||||
|
.order(-2),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
let focus_on_diff = self.focus == Focus::Diff;
|
|
||||||
out.push(CommandInfo::new(
|
|
||||||
commands::STATUS_FOCUS_LEFT,
|
|
||||||
true,
|
|
||||||
(self.visible && focus_on_diff) || force_all,
|
|
||||||
));
|
|
||||||
out.push(CommandInfo::new(
|
|
||||||
commands::STATUS_FOCUS_RIGHT,
|
|
||||||
self.can_focus_diff(),
|
|
||||||
(self.visible && !focus_on_diff) || force_all,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
out.push(
|
|
||||||
CommandInfo::new(
|
|
||||||
commands::SELECT_STATUS,
|
|
||||||
true,
|
|
||||||
(self.visible && self.focus == Focus::Diff)
|
|
||||||
|| force_all,
|
|
||||||
)
|
|
||||||
.hidden(),
|
|
||||||
);
|
|
||||||
|
|
||||||
out.push(
|
|
||||||
CommandInfo::new(
|
|
||||||
commands::SELECT_STAGING,
|
|
||||||
true,
|
|
||||||
(self.visible && self.focus == Focus::WorkDir)
|
|
||||||
|| force_all,
|
|
||||||
)
|
|
||||||
.order(-2),
|
|
||||||
);
|
|
||||||
|
|
||||||
out.push(
|
|
||||||
CommandInfo::new(
|
|
||||||
commands::SELECT_UNSTAGED,
|
|
||||||
true,
|
|
||||||
(self.visible && self.focus == Focus::Stage)
|
|
||||||
|| force_all,
|
|
||||||
)
|
|
||||||
.order(-2),
|
|
||||||
);
|
|
||||||
|
|
||||||
if self.visible {
|
if self.visible {
|
||||||
CommandBlocking::Blocking
|
CommandBlocking::Blocking
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue