This commit is contained in:
Stephan Dilly 2020-04-21 18:02:27 +02:00
parent ac8cae6e84
commit 72a1f94483
2 changed files with 13 additions and 3 deletions

View file

@ -237,7 +237,8 @@ impl Component for ChangesComponent {
}
true
}
keys::STATUS_RESET_FILE => {
keys::STATUS_RESET_FILE_1
| keys::STATUS_RESET_FILE_2 => {
self.is_working_dir
&& self.dispatch_reset_workdir()
}

View file

@ -7,12 +7,17 @@ const fn no_mod(code: KeyCode) -> KeyEvent {
}
}
const fn with_mod(
code: KeyCode,
modifiers: KeyModifiers,
) -> KeyEvent {
KeyEvent { code, modifiers }
}
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);
pub const STATUS_RESET_FILE: KeyEvent = no_mod(KeyCode::Char('D'));
pub const STATUS_STAGE_FILE: KeyEvent = no_mod(KeyCode::Enter);
pub const EXIT_1: KeyEvent = no_mod(KeyCode::Esc);
pub const EXIT_POPUP: KeyEvent = no_mod(KeyCode::Esc);
pub const EXIT_2: KeyEvent = no_mod(KeyCode::Char('q'));
@ -21,3 +26,7 @@ pub const OPEN_COMMIT: KeyEvent = no_mod(KeyCode::Char('c'));
pub const OPEN_HELP: KeyEvent = no_mod(KeyCode::Char('h'));
pub const MOVE_UP: KeyEvent = no_mod(KeyCode::Up);
pub const MOVE_DOWN: KeyEvent = no_mod(KeyCode::Down);
pub const STATUS_STAGE_FILE: KeyEvent = no_mod(KeyCode::Enter);
pub const STATUS_RESET_FILE_1: KeyEvent = no_mod(KeyCode::Char('D'));
pub const STATUS_RESET_FILE_2: KeyEvent =
with_mod(KeyCode::Char('D'), KeyModifiers::SHIFT);