mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
fix "add hunk" using "revert hunk" key in command bar
This commit is contained in:
parent
425963ca58
commit
aa1bf4fded
5 changed files with 11 additions and 14 deletions
|
|
@ -43,11 +43,10 @@
|
|||
|
||||
edit_file: ( code: Char('I'), modifiers: ( bits: 0,),),
|
||||
|
||||
status_stage_file: ( code: Enter, modifiers: ( bits: 0,),),
|
||||
status_toggle_item: ( code: Enter, modifiers: ( bits: 0,),),
|
||||
status_stage_all: ( code: Char('a'), modifiers: ( bits: 0,),),
|
||||
status_reset_file: ( code: Char('U'), modifiers: ( bits: 0,),),
|
||||
|
||||
diff_reset_hunk: ( code: Enter, modifiers: ( bits: 0,),),
|
||||
status_reset_item: ( code: Char('U'), modifiers: ( bits: 0,),),
|
||||
status_ignore_file: ( code: Char('i'), modifiers: ( bits: 0,),),
|
||||
|
||||
stashing_save: ( code: Char('w'), modifiers: ( bits: 0,),),
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ impl Component for ChangesComponent {
|
|||
.borrow_mut()
|
||||
.push_back(InternalEvent::OpenCommit);
|
||||
Ok(true)
|
||||
} else if e == self.key_config.status_stage_file {
|
||||
} else if e == self.key_config.status_toggle_item {
|
||||
try_or_popup!(
|
||||
self,
|
||||
"staging error:",
|
||||
|
|
@ -291,7 +291,7 @@ impl Component for ChangesComponent {
|
|||
self.stage_remove_all()?;
|
||||
}
|
||||
Ok(true)
|
||||
} else if e == self.key_config.status_reset_file
|
||||
} else if e == self.key_config.status_reset_item
|
||||
&& self.is_working_dir
|
||||
{
|
||||
Ok(self.dispatch_reset_workdir())
|
||||
|
|
|
|||
|
|
@ -687,7 +687,7 @@ impl Component for DiffComponent {
|
|||
self.stage_hunk()?;
|
||||
}
|
||||
Ok(true)
|
||||
} else if e == self.key_config.diff_reset_hunk
|
||||
} else if e == self.key_config.status_reset_item
|
||||
&& !self.is_immutable
|
||||
&& !self.is_stage()
|
||||
{
|
||||
|
|
|
|||
10
src/keys.rs
10
src/keys.rs
|
|
@ -48,10 +48,9 @@ pub struct KeyConfig {
|
|||
pub shift_down: KeyEvent,
|
||||
pub enter: KeyEvent,
|
||||
pub edit_file: KeyEvent,
|
||||
pub status_stage_file: KeyEvent,
|
||||
pub status_stage_all: KeyEvent,
|
||||
pub status_reset_file: KeyEvent,
|
||||
pub diff_reset_hunk: KeyEvent,
|
||||
pub status_toggle_item: KeyEvent,
|
||||
pub status_reset_item: KeyEvent,
|
||||
pub status_ignore_file: KeyEvent,
|
||||
pub stashing_save: KeyEvent,
|
||||
pub stashing_toggle_untracked: KeyEvent,
|
||||
|
|
@ -101,10 +100,9 @@ impl Default for KeyConfig {
|
|||
shift_down: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::SHIFT},
|
||||
enter: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
|
||||
edit_file: KeyEvent { code: KeyCode::Char('e'), modifiers: KeyModifiers::empty()},
|
||||
status_stage_file: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
|
||||
status_toggle_item: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
|
||||
status_stage_all: KeyEvent { code: KeyCode::Char('a'), modifiers: KeyModifiers::empty()},
|
||||
status_reset_file: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
|
||||
diff_reset_hunk: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
|
||||
status_reset_item: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
|
||||
status_ignore_file: KeyEvent { code: KeyCode::Char('i'), modifiers: KeyModifiers::empty()},
|
||||
stashing_save: KeyEvent { code: KeyCode::Char('s'), modifiers: KeyModifiers::empty()},
|
||||
stashing_toggle_untracked: KeyEvent { code: KeyCode::Char('u'), modifiers: KeyModifiers::empty()},
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Add hunk [{}]",
|
||||
get_hint(key_config.diff_reset_hunk),
|
||||
get_hint(key_config.status_toggle_item),
|
||||
),
|
||||
"adds selected hunk to stage",
|
||||
CMD_GROUP_DIFF,
|
||||
|
|
@ -267,7 +267,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Revert hunk [{}]",
|
||||
get_hint(key_config.status_reset_file),
|
||||
get_hint(key_config.status_reset_item),
|
||||
),
|
||||
"reverts selected hunk",
|
||||
CMD_GROUP_DIFF,
|
||||
|
|
|
|||
Loading…
Reference in a new issue