mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-27 19:14:26 +03:00
Add specific key bindings to stage / unstage items (#930)
* Add specific key bindings to stage / unstage items Feature requested by Issue #909. * Updating Help popup with stage / unstage keys * Merging staging and unstaging into a single `stage_unstage_item` key * Add/remove hunk now use the `stage_unstage_item` key
This commit is contained in:
parent
8486233053
commit
6ae5b5e2b2
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Added
|
||||
- support rebasing branches with conflicts ([#895](https://github.com/extrawurst/gitui/issues/895))
|
||||
- add a key binding to stage / unstage items [[@alessandroasm](https://github.com/alessandroasm)] ([#909](https://github.com/extrawurst/gitui/issues/909))
|
||||
- switch to status tab after merging or rebasing with conflicts ([#926](https://github.com/extrawurst/gitui/issues/926))
|
||||
|
||||
## Fixed
|
||||
|
@ -233,7 +233,7 @@ impl Component for ChangesComponent {
|
||||
|
||||
if self.focused() {
|
||||
if let Event::Key(e) = ev {
|
||||
return if e == self.key_config.enter {
|
||||
return if e == self.key_config.stage_unstage_item {
|
||||
try_or_popup!(
|
||||
self,
|
||||
"staging error:",
|
||||
|
@ -738,7 +738,7 @@ impl Component for DiffComponent {
|
||||
} else if e == self.key_config.page_down {
|
||||
self.move_selection(ScrollType::PageDown);
|
||||
Ok(EventState::Consumed)
|
||||
} else if e == self.key_config.enter
|
||||
} else if e == self.key_config.stage_unstage_item
|
||||
&& !self.is_immutable
|
||||
{
|
||||
try_or_popup!(
|
||||
|
@ -88,6 +88,7 @@ pub struct KeyConfig {
|
||||
pub pull: KeyEvent,
|
||||
pub abort_merge: KeyEvent,
|
||||
pub undo_commit: KeyEvent,
|
||||
pub stage_unstage_item: KeyEvent,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
@ -161,6 +162,7 @@ impl Default for KeyConfig {
|
||||
abort_merge: KeyEvent { code: KeyCode::Char('A'), modifiers: KeyModifiers::SHIFT},
|
||||
open_file_tree: KeyEvent { code: KeyCode::Char('F'), modifiers: KeyModifiers::SHIFT},
|
||||
file_find: KeyEvent { code: KeyCode::Char('f'), modifiers: KeyModifiers::empty()},
|
||||
stage_unstage_item: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Add hunk [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
key_config.get_hint(key_config.stage_unstage_item),
|
||||
),
|
||||
"adds selected hunk to stage",
|
||||
CMD_GROUP_DIFF,
|
||||
@ -586,7 +586,7 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Remove hunk [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
key_config.get_hint(key_config.stage_unstage_item),
|
||||
),
|
||||
"removes selected hunk from stage",
|
||||
CMD_GROUP_DIFF,
|
||||
@ -751,7 +751,7 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Stage [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
key_config.get_hint(key_config.stage_unstage_item),
|
||||
),
|
||||
"stage currently selected file or entire path",
|
||||
CMD_GROUP_CHANGES,
|
||||
@ -771,7 +771,7 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Unstage [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
key_config.get_hint(key_config.stage_unstage_item),
|
||||
),
|
||||
"unstage currently selected file or entire path",
|
||||
CMD_GROUP_CHANGES,
|
||||
|
@ -100,6 +100,8 @@
|
||||
open_file_tree: ( code: Char('F'), modifiers: ( bits: 1,),),
|
||||
file_find: ( code: Char('f'), modifiers: ( bits: 0,),),
|
||||
|
||||
stage_unstage_item: ( code: Enter, modifiers: ( bits: 0,),),
|
||||
|
||||
//removed in 0.11
|
||||
//tab_toggle_reverse_windows: ( code: BackTab, modifiers: ( bits: 1,),),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user