mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-22 11:03:25 +03:00
remove focus key bindings
merge them into `move_XYZ` keys
This commit is contained in:
parent
201561bc7a
commit
8f7f35b8a9
@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
![reset](assets/reset_in_log.gif)
|
||||
|
||||
### Breaking Change
|
||||
* `focus_XYZ` key bindings are merged into the `move_XYZ` set, so only one way to bind arrow-like keys from now on ([#1539](https://github.com/extrawurst/gitui/issues/1539))
|
||||
|
||||
### Added
|
||||
* list changes in commit message inside external editor [[@bc-universe]](https://github.com/bc-universe) ([#1420](https://github.com/extrawurst/gitui/issues/1420))
|
||||
* allow detaching HEAD and checking out specific commit from log view [[@fralcow]](https://github.com/fralcow) ([#1499](https://github.com/extrawurst/gitui/pull/1499))
|
||||
|
@ -36,6 +36,8 @@ filetreelist = { path = "./filetreelist", version = "0.5" }
|
||||
fuzzy-matcher = "0.3"
|
||||
gh-emoji = { version = "1.0", optional = true }
|
||||
itertools = "0.10"
|
||||
|
||||
|
||||
log = "0.4"
|
||||
notify = "5.1"
|
||||
notify-debouncer-mini = "0.2"
|
||||
|
@ -7,11 +7,6 @@ However popular demand lead to fully customizability of the key bindings.
|
||||
Create a `key_bindings.ron` file like this:
|
||||
```
|
||||
(
|
||||
focus_right: Some(( code: Char('l'), modifiers: ( bits: 0,),)),
|
||||
focus_left: Some(( code: Char('h'), modifiers: ( bits: 0,),)),
|
||||
focus_above: Some(( code: Char('k'), modifiers: ( bits: 0,),)),
|
||||
focus_below: Some(( code: Char('j'), modifiers: ( bits: 0,),)),
|
||||
|
||||
move_left: Some(( code: Char('h'), modifiers: ( bits: 0,),)),
|
||||
move_right: Some(( code: Char('l'), modifiers: ( bits: 0,),)),
|
||||
move_up: Some(( code: Char('k'), modifiers: ( bits: 0,),)),
|
||||
|
@ -224,7 +224,7 @@ impl Component for BlameFileComponent {
|
||||
self.move_selection(ScrollType::PageUp);
|
||||
} else if key_match(
|
||||
key,
|
||||
self.key_config.keys.focus_right,
|
||||
self.key_config.keys.move_right,
|
||||
) {
|
||||
if let Some(commit_id) = self.selected_commit() {
|
||||
self.hide_stacked(true);
|
||||
|
@ -234,18 +234,14 @@ impl Component for CommitDetailsComponent {
|
||||
|
||||
if self.focused() {
|
||||
if let Event::Key(e) = ev {
|
||||
return if key_match(
|
||||
e,
|
||||
self.key_config.keys.focus_below,
|
||||
) && self.details_focused()
|
||||
return if key_match(e, self.key_config.keys.move_down)
|
||||
&& self.details_focused()
|
||||
{
|
||||
self.set_details_focus(false);
|
||||
self.file_tree.focus(true);
|
||||
Ok(EventState::Consumed)
|
||||
} else if key_match(
|
||||
e,
|
||||
self.key_config.keys.focus_above,
|
||||
) && self.file_tree.focused()
|
||||
} else if key_match(e, self.key_config.keys.move_up)
|
||||
&& self.file_tree.focused()
|
||||
&& !self.is_compare()
|
||||
{
|
||||
self.file_tree.focus(false);
|
||||
|
@ -129,15 +129,13 @@ impl Component for CompareCommitsComponent {
|
||||
}
|
||||
} else if key_match(
|
||||
e,
|
||||
self.key_config.keys.focus_right,
|
||||
self.key_config.keys.move_right,
|
||||
) && self.can_focus_diff()
|
||||
{
|
||||
self.details.focus(false);
|
||||
self.diff.focus(true);
|
||||
} else if key_match(
|
||||
e,
|
||||
self.key_config.keys.focus_left,
|
||||
) {
|
||||
} else if key_match(e, self.key_config.keys.move_left)
|
||||
{
|
||||
self.hide_stacked(false);
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ impl Component for FileRevlogComponent {
|
||||
}
|
||||
} else if key_match(
|
||||
key,
|
||||
self.key_config.keys.focus_right,
|
||||
self.key_config.keys.move_right,
|
||||
) && self.can_focus_diff()
|
||||
{
|
||||
self.diff.focus(true);
|
||||
|
@ -165,15 +165,13 @@ impl Component for InspectCommitComponent {
|
||||
}
|
||||
} else if key_match(
|
||||
e,
|
||||
self.key_config.keys.focus_right,
|
||||
self.key_config.keys.move_right,
|
||||
) && self.can_focus_diff()
|
||||
{
|
||||
self.details.focus(false);
|
||||
self.diff.focus(true);
|
||||
} else if key_match(
|
||||
e,
|
||||
self.key_config.keys.focus_left,
|
||||
) {
|
||||
} else if key_match(e, self.key_config.keys.move_left)
|
||||
{
|
||||
self.hide_stacked(false);
|
||||
}
|
||||
|
||||
|
@ -44,10 +44,6 @@ pub struct KeysList {
|
||||
pub tab_toggle: GituiKeyEvent,
|
||||
pub tab_toggle_reverse: GituiKeyEvent,
|
||||
pub toggle_workarea: GituiKeyEvent,
|
||||
pub focus_right: GituiKeyEvent,
|
||||
pub focus_left: GituiKeyEvent,
|
||||
pub focus_above: GituiKeyEvent,
|
||||
pub focus_below: GituiKeyEvent,
|
||||
pub exit: GituiKeyEvent,
|
||||
pub quit: GituiKeyEvent,
|
||||
pub exit_popup: GituiKeyEvent,
|
||||
@ -57,12 +53,12 @@ pub struct KeysList {
|
||||
pub open_options: GituiKeyEvent,
|
||||
pub move_left: GituiKeyEvent,
|
||||
pub move_right: GituiKeyEvent,
|
||||
pub move_up: GituiKeyEvent,
|
||||
pub move_down: GituiKeyEvent,
|
||||
pub tree_collapse_recursive: GituiKeyEvent,
|
||||
pub tree_expand_recursive: GituiKeyEvent,
|
||||
pub home: GituiKeyEvent,
|
||||
pub end: GituiKeyEvent,
|
||||
pub move_up: GituiKeyEvent,
|
||||
pub move_down: GituiKeyEvent,
|
||||
pub popup_up: GituiKeyEvent,
|
||||
pub popup_down: GituiKeyEvent,
|
||||
pub page_down: GituiKeyEvent,
|
||||
@ -130,10 +126,6 @@ impl Default for KeysList {
|
||||
tab_toggle: GituiKeyEvent::new(KeyCode::Tab, KeyModifiers::empty()),
|
||||
tab_toggle_reverse: GituiKeyEvent::new(KeyCode::BackTab, KeyModifiers::SHIFT),
|
||||
toggle_workarea: GituiKeyEvent::new(KeyCode::Char('w'), KeyModifiers::empty()),
|
||||
focus_right: GituiKeyEvent::new(KeyCode::Right, KeyModifiers::empty()),
|
||||
focus_left: GituiKeyEvent::new(KeyCode::Left, KeyModifiers::empty()),
|
||||
focus_above: GituiKeyEvent::new(KeyCode::Up, KeyModifiers::empty()),
|
||||
focus_below: GituiKeyEvent::new(KeyCode::Down, KeyModifiers::empty()),
|
||||
exit: GituiKeyEvent::new(KeyCode::Char('c'), KeyModifiers::CONTROL),
|
||||
quit: GituiKeyEvent::new(KeyCode::Char('q'), KeyModifiers::empty()),
|
||||
exit_popup: GituiKeyEvent::new(KeyCode::Esc, KeyModifiers::empty()),
|
||||
|
@ -15,10 +15,6 @@ pub struct KeysListFile {
|
||||
pub tab_toggle: Option<GituiKeyEvent>,
|
||||
pub tab_toggle_reverse: Option<GituiKeyEvent>,
|
||||
pub toggle_workarea: Option<GituiKeyEvent>,
|
||||
pub focus_right: Option<GituiKeyEvent>,
|
||||
pub focus_left: Option<GituiKeyEvent>,
|
||||
pub focus_above: Option<GituiKeyEvent>,
|
||||
pub focus_below: Option<GituiKeyEvent>,
|
||||
pub exit: Option<GituiKeyEvent>,
|
||||
pub quit: Option<GituiKeyEvent>,
|
||||
pub exit_popup: Option<GituiKeyEvent>,
|
||||
@ -110,10 +106,6 @@ impl KeysListFile {
|
||||
tab_toggle: self.tab_toggle.unwrap_or(default.tab_toggle),
|
||||
tab_toggle_reverse: self.tab_toggle_reverse.unwrap_or(default.tab_toggle_reverse),
|
||||
toggle_workarea: self.toggle_workarea.unwrap_or(default.toggle_workarea),
|
||||
focus_right: self.focus_right.unwrap_or(default.focus_right),
|
||||
focus_left: self.focus_left.unwrap_or(default.focus_left),
|
||||
focus_above: self.focus_above.unwrap_or(default.focus_above),
|
||||
focus_below: self.focus_below.unwrap_or(default.focus_below),
|
||||
exit: self.exit.unwrap_or(default.exit),
|
||||
quit: self.quit.unwrap_or(default.quit),
|
||||
exit_popup: self.exit_popup.unwrap_or(default.exit_popup),
|
||||
|
@ -517,8 +517,8 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Scroll [{}{}]",
|
||||
key_config.get_hint(key_config.keys.focus_above),
|
||||
key_config.get_hint(key_config.keys.focus_below)
|
||||
key_config.get_hint(key_config.keys.move_up),
|
||||
key_config.get_hint(key_config.keys.move_down)
|
||||
),
|
||||
"scroll up or down in focused view",
|
||||
CMD_GROUP_GENERAL,
|
||||
@ -990,7 +990,7 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Back [{}]",
|
||||
key_config.get_hint(key_config.keys.focus_left),
|
||||
key_config.get_hint(key_config.keys.move_left),
|
||||
),
|
||||
"view and select changed files",
|
||||
CMD_GROUP_GENERAL,
|
||||
@ -1002,7 +1002,7 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Diff [{}]",
|
||||
key_config.get_hint(key_config.keys.focus_right),
|
||||
key_config.get_hint(key_config.keys.move_right),
|
||||
),
|
||||
"inspect file diff",
|
||||
CMD_GROUP_GENERAL,
|
||||
@ -1154,7 +1154,7 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Inspect [{}]",
|
||||
key_config.get_hint(key_config.keys.focus_right),
|
||||
key_config.get_hint(key_config.keys.move_right),
|
||||
),
|
||||
"inspect selected commit in detail",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
@ -285,7 +285,7 @@ impl Component for Revlog {
|
||||
);
|
||||
} else if key_match(
|
||||
k,
|
||||
self.key_config.keys.focus_right,
|
||||
self.key_config.keys.move_right,
|
||||
) && self.commit_details.is_visible()
|
||||
{
|
||||
self.inspect_commit();
|
||||
|
@ -852,7 +852,7 @@ impl Component for Status {
|
||||
.map(Into::into)
|
||||
} else if key_match(
|
||||
k,
|
||||
self.key_config.keys.focus_right,
|
||||
self.key_config.keys.move_right,
|
||||
) && self.can_focus_diff()
|
||||
{
|
||||
self.switch_focus(Focus::Diff).map(Into::into)
|
||||
|
@ -13,17 +13,13 @@
|
||||
// find `KeysList` type in src/keys/key_list.rs for all possible keys.
|
||||
// every key not overwritten via the config file will use the default specified there
|
||||
(
|
||||
focus_right: Some(( code: Char('l'), modifiers: ( bits: 0,),)),
|
||||
focus_left: Some(( code: Char('h'), modifiers: ( bits: 0,),)),
|
||||
focus_above: Some(( code: Char('k'), modifiers: ( bits: 0,),)),
|
||||
focus_below: Some(( code: Char('j'), modifiers: ( bits: 0,),)),
|
||||
|
||||
open_help: Some(( code: F(1), modifiers: ( bits: 0,),)),
|
||||
|
||||
move_left: Some(( code: Char('h'), modifiers: ( bits: 0,),)),
|
||||
move_right: Some(( code: Char('l'), modifiers: ( bits: 0,),)),
|
||||
move_up: Some(( code: Char('k'), modifiers: ( bits: 0,),)),
|
||||
move_down: Some(( code: Char('j'), modifiers: ( bits: 0,),)),
|
||||
|
||||
popup_up: Some(( code: Char('p'), modifiers: ( bits: 2,),)),
|
||||
popup_down: Some(( code: Char('n'), modifiers: ( bits: 2,),)),
|
||||
page_up: Some(( code: Char('b'), modifiers: ( bits: 2,),)),
|
||||
|
Loading…
Reference in New Issue
Block a user