mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28: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,),),
|
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_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,),),
|
status_ignore_file: ( code: Char('i'), modifiers: ( bits: 0,),),
|
||||||
|
|
||||||
stashing_save: ( code: Char('w'), modifiers: ( bits: 0,),),
|
stashing_save: ( code: Char('w'), modifiers: ( bits: 0,),),
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ impl Component for ChangesComponent {
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.push_back(InternalEvent::OpenCommit);
|
.push_back(InternalEvent::OpenCommit);
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if e == self.key_config.status_stage_file {
|
} else if e == self.key_config.status_toggle_item {
|
||||||
try_or_popup!(
|
try_or_popup!(
|
||||||
self,
|
self,
|
||||||
"staging error:",
|
"staging error:",
|
||||||
|
|
@ -291,7 +291,7 @@ impl Component for ChangesComponent {
|
||||||
self.stage_remove_all()?;
|
self.stage_remove_all()?;
|
||||||
}
|
}
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if e == self.key_config.status_reset_file
|
} else if e == self.key_config.status_reset_item
|
||||||
&& self.is_working_dir
|
&& self.is_working_dir
|
||||||
{
|
{
|
||||||
Ok(self.dispatch_reset_workdir())
|
Ok(self.dispatch_reset_workdir())
|
||||||
|
|
|
||||||
|
|
@ -687,7 +687,7 @@ impl Component for DiffComponent {
|
||||||
self.stage_hunk()?;
|
self.stage_hunk()?;
|
||||||
}
|
}
|
||||||
Ok(true)
|
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_immutable
|
||||||
&& !self.is_stage()
|
&& !self.is_stage()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
10
src/keys.rs
10
src/keys.rs
|
|
@ -48,10 +48,9 @@ pub struct KeyConfig {
|
||||||
pub shift_down: KeyEvent,
|
pub shift_down: KeyEvent,
|
||||||
pub enter: KeyEvent,
|
pub enter: KeyEvent,
|
||||||
pub edit_file: KeyEvent,
|
pub edit_file: KeyEvent,
|
||||||
pub status_stage_file: KeyEvent,
|
|
||||||
pub status_stage_all: KeyEvent,
|
pub status_stage_all: KeyEvent,
|
||||||
pub status_reset_file: KeyEvent,
|
pub status_toggle_item: KeyEvent,
|
||||||
pub diff_reset_hunk: KeyEvent,
|
pub status_reset_item: KeyEvent,
|
||||||
pub status_ignore_file: KeyEvent,
|
pub status_ignore_file: KeyEvent,
|
||||||
pub stashing_save: KeyEvent,
|
pub stashing_save: KeyEvent,
|
||||||
pub stashing_toggle_untracked: KeyEvent,
|
pub stashing_toggle_untracked: KeyEvent,
|
||||||
|
|
@ -101,10 +100,9 @@ impl Default for KeyConfig {
|
||||||
shift_down: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::SHIFT},
|
shift_down: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::SHIFT},
|
||||||
enter: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
|
enter: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
|
||||||
edit_file: KeyEvent { code: KeyCode::Char('e'), 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_stage_all: KeyEvent { code: KeyCode::Char('a'), modifiers: KeyModifiers::empty()},
|
||||||
status_reset_file: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
|
status_reset_item: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
|
||||||
diff_reset_hunk: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
|
|
||||||
status_ignore_file: KeyEvent { code: KeyCode::Char('i'), modifiers: KeyModifiers::empty()},
|
status_ignore_file: KeyEvent { code: KeyCode::Char('i'), modifiers: KeyModifiers::empty()},
|
||||||
stashing_save: KeyEvent { code: KeyCode::Char('s'), modifiers: KeyModifiers::empty()},
|
stashing_save: KeyEvent { code: KeyCode::Char('s'), modifiers: KeyModifiers::empty()},
|
||||||
stashing_toggle_untracked: KeyEvent { code: KeyCode::Char('u'), modifiers: KeyModifiers::empty()},
|
stashing_toggle_untracked: KeyEvent { code: KeyCode::Char('u'), modifiers: KeyModifiers::empty()},
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ pub mod commands {
|
||||||
CommandText::new(
|
CommandText::new(
|
||||||
format!(
|
format!(
|
||||||
"Add hunk [{}]",
|
"Add hunk [{}]",
|
||||||
get_hint(key_config.diff_reset_hunk),
|
get_hint(key_config.status_toggle_item),
|
||||||
),
|
),
|
||||||
"adds selected hunk to stage",
|
"adds selected hunk to stage",
|
||||||
CMD_GROUP_DIFF,
|
CMD_GROUP_DIFF,
|
||||||
|
|
@ -267,7 +267,7 @@ pub mod commands {
|
||||||
CommandText::new(
|
CommandText::new(
|
||||||
format!(
|
format!(
|
||||||
"Revert hunk [{}]",
|
"Revert hunk [{}]",
|
||||||
get_hint(key_config.status_reset_file),
|
get_hint(key_config.status_reset_item),
|
||||||
),
|
),
|
||||||
"reverts selected hunk",
|
"reverts selected hunk",
|
||||||
CMD_GROUP_DIFF,
|
CMD_GROUP_DIFF,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue