mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-23 20:52:54 +03:00
move more into sub components
This commit is contained in:
parent
8937f5f437
commit
4bd9826666
@ -172,10 +172,6 @@ impl App {
|
||||
DiffTarget::WorkingDir => Focus::WorkDir,
|
||||
})
|
||||
}
|
||||
//TODO: move down
|
||||
keys::OPEN_COMMIT if !self.index.is_empty() => {
|
||||
self.commit.show();
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
}
|
||||
@ -187,6 +183,7 @@ impl App {
|
||||
|
||||
self.git_diff.refresh();
|
||||
self.git_status.fetch(current_tick());
|
||||
self.commit.set_stage_empty(self.index.is_empty());
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{CommandInfo, Component, DrawableComponent, EventUpdate};
|
||||
use crate::{strings, ui};
|
||||
use crate::{keys, strings, ui};
|
||||
use asyncgit::{sync, CWD};
|
||||
use crossterm::event::{Event, KeyCode};
|
||||
use std::borrow::Cow;
|
||||
@ -16,6 +16,7 @@ pub struct CommitComponent {
|
||||
msg: String,
|
||||
// focused: bool,
|
||||
visible: bool,
|
||||
stage_empty: bool,
|
||||
}
|
||||
|
||||
impl DrawableComponent for CommitComponent {
|
||||
@ -83,6 +84,15 @@ impl Component for CommitComponent {
|
||||
_ => EventUpdate::None,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if let Event::Key(e) = ev {
|
||||
if let keys::OPEN_COMMIT = e {
|
||||
if !self.stage_empty {
|
||||
self.show();
|
||||
return Some(EventUpdate::Changes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
@ -111,4 +121,9 @@ impl CommitComponent {
|
||||
fn can_commit(&self) -> bool {
|
||||
!self.msg.is_empty()
|
||||
}
|
||||
|
||||
///
|
||||
pub fn set_stage_empty(&mut self, empty: bool) {
|
||||
self.stage_empty = empty;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user