Skip to content

Commit aa1bf4f

Browse files
author
Stephan Dilly
committed
fix "add hunk" using "revert hunk" key in command bar
1 parent 425963c commit aa1bf4f

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

assets/vim_style_key_config.ron

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@
4343

4444
edit_file: ( code: Char('I'), modifiers: ( bits: 0,),),
4545

46-
status_stage_file: ( code: Enter, modifiers: ( bits: 0,),),
46+
status_toggle_item: ( code: Enter, modifiers: ( bits: 0,),),
4747
status_stage_all: ( code: Char('a'), modifiers: ( bits: 0,),),
48-
status_reset_file: ( code: Char('U'), modifiers: ( bits: 0,),),
4948

50-
diff_reset_hunk: ( code: Enter, modifiers: ( bits: 0,),),
49+
status_reset_item: ( code: Char('U'), modifiers: ( bits: 0,),),
5150
status_ignore_file: ( code: Char('i'), modifiers: ( bits: 0,),),
5251

5352
stashing_save: ( code: Char('w'), modifiers: ( bits: 0,),),

src/components/changes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl Component for ChangesComponent {
267267
.borrow_mut()
268268
.push_back(InternalEvent::OpenCommit);
269269
Ok(true)
270-
} else if e == self.key_config.status_stage_file {
270+
} else if e == self.key_config.status_toggle_item {
271271
try_or_popup!(
272272
self,
273273
"staging error:",
@@ -291,7 +291,7 @@ impl Component for ChangesComponent {
291291
self.stage_remove_all()?;
292292
}
293293
Ok(true)
294-
} else if e == self.key_config.status_reset_file
294+
} else if e == self.key_config.status_reset_item
295295
&& self.is_working_dir
296296
{
297297
Ok(self.dispatch_reset_workdir())

src/components/diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ impl Component for DiffComponent {
687687
self.stage_hunk()?;
688688
}
689689
Ok(true)
690-
} else if e == self.key_config.diff_reset_hunk
690+
} else if e == self.key_config.status_reset_item
691691
&& !self.is_immutable
692692
&& !self.is_stage()
693693
{

src/keys.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ pub struct KeyConfig {
4848
pub shift_down: KeyEvent,
4949
pub enter: KeyEvent,
5050
pub edit_file: KeyEvent,
51-
pub status_stage_file: KeyEvent,
5251
pub status_stage_all: KeyEvent,
53-
pub status_reset_file: KeyEvent,
54-
pub diff_reset_hunk: KeyEvent,
52+
pub status_toggle_item: KeyEvent,
53+
pub status_reset_item: KeyEvent,
5554
pub status_ignore_file: KeyEvent,
5655
pub stashing_save: KeyEvent,
5756
pub stashing_toggle_untracked: KeyEvent,
@@ -101,10 +100,9 @@ impl Default for KeyConfig {
101100
shift_down: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::SHIFT},
102101
enter: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
103102
edit_file: KeyEvent { code: KeyCode::Char('e'), modifiers: KeyModifiers::empty()},
104-
status_stage_file: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
103+
status_toggle_item: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
105104
status_stage_all: KeyEvent { code: KeyCode::Char('a'), modifiers: KeyModifiers::empty()},
106-
status_reset_file: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
107-
diff_reset_hunk: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
105+
status_reset_item: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
108106
status_ignore_file: KeyEvent { code: KeyCode::Char('i'), modifiers: KeyModifiers::empty()},
109107
stashing_save: KeyEvent { code: KeyCode::Char('s'), modifiers: KeyModifiers::empty()},
110108
stashing_toggle_untracked: KeyEvent { code: KeyCode::Char('u'), modifiers: KeyModifiers::empty()},

src/strings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub mod commands {
255255
CommandText::new(
256256
format!(
257257
"Add hunk [{}]",
258-
get_hint(key_config.diff_reset_hunk),
258+
get_hint(key_config.status_toggle_item),
259259
),
260260
"adds selected hunk to stage",
261261
CMD_GROUP_DIFF,
@@ -267,7 +267,7 @@ pub mod commands {
267267
CommandText::new(
268268
format!(
269269
"Revert hunk [{}]",
270-
get_hint(key_config.status_reset_file),
270+
get_hint(key_config.status_reset_item),
271271
),
272272
"reverts selected hunk",
273273
CMD_GROUP_DIFF,

0 commit comments

Comments
 (0)