diff --git a/src/app.rs b/src/app.rs index e2271091..832a6faa 100644 --- a/src/app.rs +++ b/src/app.rs @@ -154,8 +154,13 @@ impl App { self.switch_focus(Focus::Status); } else if ev == Event::Key(keys::FOCUS_STAGE) { self.switch_focus(Focus::Stage); - } else if ev == Event::Key(keys::FOCUS_DIFF) { + } else if ev == Event::Key(keys::FOCUS_RIGHT) { self.switch_focus(Focus::Diff); + } else if ev == Event::Key(keys::FOCUS_LEFT) { + self.switch_focus(match self.diff_target { + DiffTarget::Stage => Focus::Stage, + DiffTarget::WorkingDir => Focus::Status, + }); } if let Event::Key(e) = ev { @@ -222,6 +227,14 @@ impl App { }); } + res.push(CommandInfo { + name: if self.focus == Focus::Diff { + strings::CMD_STATUS_LEFT.to_string() + } else { + strings::CMD_STATUS_RIGHT.to_string() + }, + enabled: true, + }); res.push(CommandInfo { name: strings::CMD_STATUS_QUIT.to_string(), enabled: true, diff --git a/src/keys.rs b/src/keys.rs index 6c35140e..17868f66 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -8,5 +8,6 @@ const fn no_mod(code: KeyCode) -> KeyEvent { } pub static FOCUS_STATUS: KeyEvent = no_mod(KeyCode::Char('1')); -pub static FOCUS_DIFF: KeyEvent = no_mod(KeyCode::Char('2')); -pub static FOCUS_STAGE: KeyEvent = no_mod(KeyCode::Char('3')); +pub static FOCUS_STAGE: KeyEvent = no_mod(KeyCode::Char('2')); +pub static FOCUS_RIGHT: KeyEvent = no_mod(KeyCode::Right); +pub static FOCUS_LEFT: KeyEvent = no_mod(KeyCode::Left); diff --git a/src/strings.rs b/src/strings.rs index 0b6e5449..2f2c4e85 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -1,6 +1,6 @@ pub static TITLE_STATUS: &str = "Status [1]"; -pub static TITLE_DIFF: &str = "Diff [2]"; -pub static TITLE_INDEX: &str = "Index [3]"; +pub static TITLE_DIFF: &str = "Diff"; +pub static TITLE_INDEX: &str = "Index [2]"; pub static TAB_STATUS: &str = "Status"; pub static TAB_DIVIDER: &str = " | "; @@ -9,6 +9,8 @@ pub static CMD_STATUS_STAGE: &str = "Stage File [enter]"; pub static CMD_STATUS_UNSTAGE: &str = "Unstage File [enter]"; pub static CMD_STATUS_RESET: &str = "Reset File [D]"; pub static CMD_STATUS_QUIT: &str = "Quit [esc,q]"; +pub static CMD_STATUS_LEFT: &str = "Back [←]"; +pub static CMD_STATUS_RIGHT: &str = "Diff [→]"; pub static CMD_SPLITTER: &str = " "; pub static DIFF_CMD_SCROLL: &str = "Scroll [↑↓]";