renames,cleanup

This commit is contained in:
Stephan Dilly 2020-03-30 16:43:37 +02:00
parent 73557113d8
commit d21ed0467b
2 changed files with 8 additions and 8 deletions

View file

@ -32,7 +32,7 @@ enum DiffTarget {
///
#[derive(PartialEq)]
enum Focus {
Status,
WorkDir,
Diff,
Stage,
}
@ -56,7 +56,7 @@ impl App {
///
pub fn new(sender: Sender<AsyncNotification>) -> Self {
Self {
focus: Focus::Status,
focus: Focus::WorkDir,
diff_target: DiffTarget::WorkingDir,
do_quit: false,
commit: CommitComponent::default(),
@ -169,10 +169,9 @@ impl App {
keys::EXIT_1 | keys::EXIT_2 => {
self.do_quit = true
}
keys::FOCUS_STATUS => {
self.switch_focus(Focus::Status)
keys::FOCUS_WORKDIR => {
self.switch_focus(Focus::WorkDir)
}
keys::OPEN_HELP => self.help.show(),
keys::FOCUS_STAGE => {
self.switch_focus(Focus::Stage)
}
@ -182,9 +181,10 @@ impl App {
keys::FOCUS_LEFT => {
self.switch_focus(match self.diff_target {
DiffTarget::Stage => Focus::Stage,
DiffTarget::WorkingDir => Focus::Status,
DiffTarget::WorkingDir => Focus::WorkDir,
})
}
keys::OPEN_HELP => self.help.show(),
keys::STATUS_STAGE_FILE => {
self.index_add_remove();
self.update();
@ -398,7 +398,7 @@ impl App {
self.focus = f;
match self.focus {
Focus::Status => {
Focus::WorkDir => {
self.set_diff_target(DiffTarget::WorkingDir);
self.diff.focus(false);
}

View file

@ -7,7 +7,7 @@ const fn no_mod(code: KeyCode) -> KeyEvent {
}
}
pub const FOCUS_STATUS: KeyEvent = no_mod(KeyCode::Char('1'));
pub const FOCUS_WORKDIR: KeyEvent = no_mod(KeyCode::Char('1'));
pub const FOCUS_STAGE: KeyEvent = no_mod(KeyCode::Char('2'));
pub const FOCUS_RIGHT: KeyEvent = no_mod(KeyCode::Right);
pub const FOCUS_LEFT: KeyEvent = no_mod(KeyCode::Left);