diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-02-14 20:53:42 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-14 20:53:42 +1100 |
commit | 09178a1276894acc80bab8d0a83b7d9a0e985290 (patch) | |
tree | 5cbd624f27507a6d441e31bae81a5820b2f80583 | |
parent | b66aa42ee5e7240867feb8ad57f20cac43a7dd63 (diff) | |
parent | 39c20bc63454390d9c00bfb8536e44e04afd55ca (diff) |
Merge pull request #2435 from Ryooooooga/return-alt1
-rw-r--r-- | pkg/gui/confirmation_panel.go | 12 | ||||
-rw-r--r-- | pkg/gui/controllers/commit_message_controller.go | 4 | ||||
-rw-r--r-- | pkg/gui/controllers/menu_controller.go | 4 | ||||
-rw-r--r-- | pkg/gui/controllers/merge_conflicts_controller.go | 5 | ||||
-rw-r--r-- | pkg/gui/controllers/patch_building_controller.go | 5 | ||||
-rw-r--r-- | pkg/gui/controllers/remote_branches_controller.go | 5 | ||||
-rw-r--r-- | pkg/gui/controllers/snake_controller.go | 4 | ||||
-rw-r--r-- | pkg/gui/controllers/staging_controller.go | 5 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 6 |
9 files changed, 50 insertions, 0 deletions
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 30b21f124..a60017688 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -253,6 +253,11 @@ func (gui *Gui) setKeyBindings(cancel context.CancelFunc, opts types.CreatePopup }, { ViewName: "confirmation", + Key: keybindings.GetKey(keybindingConfig.Universal.ReturnAlt1), + Handler: gui.wrappedConfirmationFunction(cancel, opts.HandleClose), + }, + { + ViewName: "confirmation", Key: keybindings.GetKey(keybindingConfig.Universal.TogglePanel), Handler: func() error { if len(gui.State.Suggestions) > 0 { @@ -278,6 +283,11 @@ func (gui *Gui) setKeyBindings(cancel context.CancelFunc, opts types.CreatePopup }, { ViewName: "suggestions", + Key: keybindings.GetKey(keybindingConfig.Universal.ReturnAlt1), + Handler: gui.wrappedConfirmationFunction(cancel, opts.HandleClose), + }, + { + ViewName: "suggestions", Key: keybindings.GetKey(keybindingConfig.Universal.TogglePanel), Handler: func() error { return gui.replaceContext(gui.State.Contexts.Confirmation) }, }, @@ -297,9 +307,11 @@ func (gui *Gui) clearConfirmationViewKeyBindings() { _ = gui.g.DeleteKeybinding("confirmation", keybindings.GetKey(keybindingConfig.Universal.Confirm), gocui.ModNone) _ = gui.g.DeleteKeybinding("confirmation", keybindings.GetKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone) _ = gui.g.DeleteKeybinding("confirmation", keybindings.GetKey(keybindingConfig.Universal.Return), gocui.ModNone) + _ = gui.g.DeleteKeybinding("confirmation", keybindings.GetKey(keybindingConfig.Universal.ReturnAlt1), gocui.ModNone) _ = gui.g.DeleteKeybinding("suggestions", keybindings.GetKey(keybindingConfig.Universal.Confirm), gocui.ModNone) _ = gui.g.DeleteKeybinding("suggestions", keybindings.GetKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone) _ = gui.g.DeleteKeybinding("suggestions", keybindings.GetKey(keybindingConfig.Universal.Return), gocui.ModNone) + _ = gui.g.DeleteKeybinding("suggestions", keybindings.GetKey(keybindingConfig.Universal.ReturnAlt1), gocui.ModNone) } func (gui *Gui) refreshSuggestions() { diff --git a/pkg/gui/controllers/commit_message_controller.go b/pkg/gui/controllers/commit_message_controller.go index e5cdb866d..4e3ccd6e2 100644 --- a/pkg/gui/controllers/commit_message_controller.go +++ b/pkg/gui/controllers/commit_message_controller.go @@ -41,6 +41,10 @@ func (self *CommitMessageController) GetKeybindings(opts types.KeybindingsOpts) Key: opts.GetKey(opts.Config.Universal.Return), Handler: self.close, }, + { + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Handler: self.close, + }, } return bindings diff --git a/pkg/gui/controllers/menu_controller.go b/pkg/gui/controllers/menu_controller.go index 9501a0bf2..4c84a82de 100644 --- a/pkg/gui/controllers/menu_controller.go +++ b/pkg/gui/controllers/menu_controller.go @@ -39,6 +39,10 @@ func (self *MenuController) GetKeybindings(opts types.KeybindingsOpts) []*types. Key: opts.GetKey(opts.Config.Universal.Return), Handler: self.close, }, + { + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Handler: self.close, + }, } return bindings diff --git a/pkg/gui/controllers/merge_conflicts_controller.go b/pkg/gui/controllers/merge_conflicts_controller.go index 40824099e..90da5283c 100644 --- a/pkg/gui/controllers/merge_conflicts_controller.go +++ b/pkg/gui/controllers/merge_conflicts_controller.go @@ -110,6 +110,11 @@ func (self *MergeConflictsController) GetKeybindings(opts types.KeybindingsOpts) Handler: self.Escape, Description: self.c.Tr.ReturnToFilesPanel, }, + { + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Handler: self.Escape, + Description: self.c.Tr.ReturnToFilesPanel, + }, } return bindings diff --git a/pkg/gui/controllers/patch_building_controller.go b/pkg/gui/controllers/patch_building_controller.go index 798472f7f..b2d60b770 100644 --- a/pkg/gui/controllers/patch_building_controller.go +++ b/pkg/gui/controllers/patch_building_controller.go @@ -44,6 +44,11 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts) Handler: self.Escape, Description: self.c.Tr.ExitCustomPatchBuilder, }, + { + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Handler: self.Escape, + Description: self.c.Tr.ExitCustomPatchBuilder, + }, } } diff --git a/pkg/gui/controllers/remote_branches_controller.go b/pkg/gui/controllers/remote_branches_controller.go index dcedde8c0..2f1382345 100644 --- a/pkg/gui/controllers/remote_branches_controller.go +++ b/pkg/gui/controllers/remote_branches_controller.go @@ -65,6 +65,11 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts) Description: self.c.Tr.ReturnToRemotesList, }, { + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Handler: self.escape, + Description: self.c.Tr.ReturnToRemotesList, + }, + { Key: opts.GetKey(opts.Config.Commits.ViewResetOptions), Handler: self.checkSelected(self.createResetMenu), Description: self.c.Tr.LcViewResetOptions, diff --git a/pkg/gui/controllers/snake_controller.go b/pkg/gui/controllers/snake_controller.go index 4217878e3..4956c0c79 100644 --- a/pkg/gui/controllers/snake_controller.go +++ b/pkg/gui/controllers/snake_controller.go @@ -47,6 +47,10 @@ func (self *SnakeController) GetKeybindings(opts types.KeybindingsOpts) []*types Key: opts.GetKey(opts.Config.Universal.Return), Handler: self.Escape, }, + { + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Handler: self.Escape, + }, } return bindings diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go index a141c4740..78129ebe0 100644 --- a/pkg/gui/controllers/staging_controller.go +++ b/pkg/gui/controllers/staging_controller.go @@ -54,6 +54,11 @@ func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*typ Description: self.c.Tr.ReturnToFilesPanel, }, { + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Handler: self.Escape, + Description: self.c.Tr.ReturnToFilesPanel, + }, + { Key: opts.GetKey(opts.Config.Universal.TogglePanel), Handler: self.TogglePanel, Description: self.c.Tr.ToggleStagingPanel, diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 572fa4594..35623b847 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -332,6 +332,12 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi Handler: self.handleSearchEscape, }, { + ViewName: "search", + Key: opts.GetKey(opts.Config.Universal.ReturnAlt1), + Modifier: gocui.ModNone, + Handler: self.handleSearchEscape, + }, + { ViewName: "confirmation", Key: opts.GetKey(opts.Config.Universal.PrevItem), Modifier: gocui.ModNone, |