fix scroll command enbled

This commit is contained in:
Stephan Dilly 2020-03-19 01:33:08 +01:00
parent 10bb26e063
commit 6db11857e0
2 changed files with 12 additions and 10 deletions

View File

@ -163,8 +163,10 @@ impl App {
.render(f, chunks[1]); .render(f, chunks[1]);
let mut cmds = self.commit.commands(); let mut cmds = self.commit.commands();
cmds.extend(self.index.commands()); if !self.commit.is_visible() {
cmds.extend(self.index_wd.commands()); cmds.extend(self.index.commands());
cmds.extend(self.index_wd.commands());
}
cmds.extend(self.commands()); cmds.extend(self.commands());
self.draw_commands(f, chunks_main[2], cmds); self.draw_commands(f, chunks_main[2], cmds);
@ -208,14 +210,14 @@ impl App {
return; return;
} }
if self.index.event(ev) {
return;
}
if self.index_wd.event(ev) {
return;
}
if !self.commit.is_visible() { if !self.commit.is_visible() {
if self.index.event(ev) {
return;
}
if self.index_wd.event(ev) {
return;
}
if ev == Event::Key(KeyCode::Esc.into()) if ev == Event::Key(KeyCode::Esc.into())
|| ev == Event::Key(KeyCode::Char('q').into()) || ev == Event::Key(KeyCode::Char('q').into())
{ {

View File

@ -88,7 +88,7 @@ impl Component for IndexComponent {
if self.focused { if self.focused {
return vec![CommandInfo { return vec![CommandInfo {
name: "Scroll [↑↓]".to_string(), name: "Scroll [↑↓]".to_string(),
enabled: self.items.len() > 0, enabled: self.items.len() > 1,
}]; }];
} }