From c8a0fe5f6773afc12a40965ce1da0951d4de3734 Mon Sep 17 00:00:00 2001 From: vlad-psh Date: Mon, 10 Jul 2023 20:58:13 +0900 Subject: [PATCH] Add alternative Confirm and Return hotkeys for confirmation windows --- docs/Config.md | 2 ++ pkg/config/user_config.go | 2 ++ pkg/gui/controllers/confirmation_controller.go | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/docs/Config.md b/docs/Config.md index 08e82b5abe6..efae1df709e 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -155,6 +155,8 @@ keybinding: goInto: '' openRecentRepos: '' confirm: '' + # confirm-prompt: 'y' # confirm prompt messages (alternative to the 'confirm') + # cancel-prompt: 'n' # close/abort prompt messages (alternative to the 'return') remove: 'd' new: 'n' edit: 'e' diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 8faff4326cf..87eda522826 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -173,6 +173,8 @@ type KeybindingUniversalConfig struct { GoInto string `yaml:"goInto"` Confirm string `yaml:"confirm"` ConfirmInEditor string `yaml:"confirmInEditor"` + ConfirmPrompt string `yaml:"confirm-prompt"` + CancelPrompt string `yaml:"cancel-prompt"` Remove string `yaml:"remove"` New string `yaml:"new"` Edit string `yaml:"edit"` diff --git a/pkg/gui/controllers/confirmation_controller.go b/pkg/gui/controllers/confirmation_controller.go index 59ddf8c4359..3635509a9e8 100644 --- a/pkg/gui/controllers/confirmation_controller.go +++ b/pkg/gui/controllers/confirmation_controller.go @@ -35,6 +35,14 @@ func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) [ Description: self.c.Tr.CloseCancel, Display: true, }, + { + Key: opts.GetKey(opts.Config.Universal.ConfirmPrompt), + Handler: func() error { return self.context().State.OnConfirm() }, + }, + { + Key: opts.GetKey(opts.Config.Universal.CancelPrompt), + Handler: func() error { return self.context().State.OnClose() }, + }, { Key: opts.GetKey(opts.Config.Universal.TogglePanel), Handler: func() error {