diff --git a/src/components/changes.rs b/src/components/changes.rs index 2765a0e162..9ce64c6cb3 100644 --- a/src/components/changes.rs +++ b/src/components/changes.rs @@ -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() } diff --git a/src/keys.rs b/src/keys.rs index 0cc009c0cc..b19038c823 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -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);