Skip to content

Commit 8627d94

Browse files
author
Stephan Dilly
committed
steamline some more command functions
1 parent df33833 commit 8627d94

File tree

3 files changed

+40
-45
lines changed

3 files changed

+40
-45
lines changed

Diff for: src/components/help.rs

+15-19
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,22 @@ impl Component for HelpComponent {
9999
out.clear();
100100
}
101101

102-
out.push(
103-
CommandInfo::new(
104-
commands::HELP_OPEN,
102+
if self.visible {
103+
out.push(CommandInfo::new(commands::SCROLL, true, true));
104+
105+
out.push(CommandInfo::new(
106+
commands::CLOSE_POPUP,
105107
true,
106-
!self.visible,
107-
)
108-
.order(99),
109-
);
110-
111-
out.push(CommandInfo::new(
112-
commands::SCROLL,
113-
true,
114-
self.visible,
115-
));
116-
117-
out.push(CommandInfo::new(
118-
commands::CLOSE_POPUP,
119-
true,
120-
self.visible,
121-
));
108+
true,
109+
));
110+
}
111+
112+
if !self.visible || force_all {
113+
out.push(
114+
CommandInfo::new(commands::HELP_OPEN, true, true)
115+
.order(99),
116+
);
117+
}
122118

123119
visibility_blocking(self)
124120
}

Diff for: src/components/inspect_commit.rs

+16-20
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,24 @@ impl Component for InspectCommitComponent {
7575
force_all,
7676
self.components().as_slice(),
7777
);
78-
}
7978

80-
out.push(
81-
CommandInfo::new(
82-
commands::CLOSE_POPUP,
79+
out.push(
80+
CommandInfo::new(commands::CLOSE_POPUP, true, true)
81+
.order(1),
82+
);
83+
84+
out.push(CommandInfo::new(
85+
commands::DIFF_FOCUS_RIGHT,
86+
self.can_focus_diff(),
87+
!self.diff.focused() || force_all,
88+
));
89+
90+
out.push(CommandInfo::new(
91+
commands::DIFF_FOCUS_LEFT,
8392
true,
84-
self.is_visible(),
85-
)
86-
.order(1),
87-
);
88-
89-
out.push(CommandInfo::new(
90-
commands::DIFF_FOCUS_RIGHT,
91-
self.can_focus_diff(),
92-
(self.is_visible() && !self.diff.focused()) || force_all,
93-
));
94-
95-
out.push(CommandInfo::new(
96-
commands::DIFF_FOCUS_LEFT,
97-
true,
98-
(self.is_visible() && self.diff.focused()) || force_all,
99-
));
93+
self.diff.focused() || force_all,
94+
));
95+
}
10096

10197
visibility_blocking(self)
10298
}

Diff for: src/components/stashmsg.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@ impl Component for StashMsgComponent {
3838
out: &mut Vec<CommandInfo>,
3939
force_all: bool,
4040
) -> CommandBlocking {
41-
self.input.commands(out, force_all);
41+
if self.is_visible() || force_all {
42+
self.input.commands(out, force_all);
43+
44+
out.push(CommandInfo::new(
45+
commands::STASHING_CONFIRM_MSG,
46+
true,
47+
true,
48+
));
49+
}
4250

43-
out.push(CommandInfo::new(
44-
commands::STASHING_CONFIRM_MSG,
45-
true,
46-
self.is_visible() || force_all,
47-
));
4851
visibility_blocking(self)
4952
}
5053

0 commit comments

Comments
 (0)