Skip to content

Commit 72a1f94

Browse files
author
Stephan Dilly
committed
workaround crossterm bug: crossterm-rs/crossterm#421
1 parent ac8cae6 commit 72a1f94

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/components/changes.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ impl Component for ChangesComponent {
237237
}
238238
true
239239
}
240-
keys::STATUS_RESET_FILE => {
240+
keys::STATUS_RESET_FILE_1
241+
| keys::STATUS_RESET_FILE_2 => {
241242
self.is_working_dir
242243
&& self.dispatch_reset_workdir()
243244
}

src/keys.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ const fn no_mod(code: KeyCode) -> KeyEvent {
77
}
88
}
99

10+
const fn with_mod(
11+
code: KeyCode,
12+
modifiers: KeyModifiers,
13+
) -> KeyEvent {
14+
KeyEvent { code, modifiers }
15+
}
16+
1017
pub const FOCUS_WORKDIR: KeyEvent = no_mod(KeyCode::Char('1'));
1118
pub const FOCUS_STAGE: KeyEvent = no_mod(KeyCode::Char('2'));
1219
pub const FOCUS_RIGHT: KeyEvent = no_mod(KeyCode::Right);
1320
pub const FOCUS_LEFT: KeyEvent = no_mod(KeyCode::Left);
14-
pub const STATUS_RESET_FILE: KeyEvent = no_mod(KeyCode::Char('D'));
15-
pub const STATUS_STAGE_FILE: KeyEvent = no_mod(KeyCode::Enter);
1621
pub const EXIT_1: KeyEvent = no_mod(KeyCode::Esc);
1722
pub const EXIT_POPUP: KeyEvent = no_mod(KeyCode::Esc);
1823
pub const EXIT_2: KeyEvent = no_mod(KeyCode::Char('q'));
@@ -21,3 +26,7 @@ pub const OPEN_COMMIT: KeyEvent = no_mod(KeyCode::Char('c'));
2126
pub const OPEN_HELP: KeyEvent = no_mod(KeyCode::Char('h'));
2227
pub const MOVE_UP: KeyEvent = no_mod(KeyCode::Up);
2328
pub const MOVE_DOWN: KeyEvent = no_mod(KeyCode::Down);
29+
pub const STATUS_STAGE_FILE: KeyEvent = no_mod(KeyCode::Enter);
30+
pub const STATUS_RESET_FILE_1: KeyEvent = no_mod(KeyCode::Char('D'));
31+
pub const STATUS_RESET_FILE_2: KeyEvent =
32+
with_mod(KeyCode::Char('D'), KeyModifiers::SHIFT);

0 commit comments

Comments
 (0)