diff --git a/pkg/gui/controllers/menu_controller.go b/pkg/gui/controllers/menu_controller.go index f217c993a..910e50668 100644 --- a/pkg/gui/controllers/menu_controller.go +++ b/pkg/gui/controllers/menu_controller.go @@ -35,6 +35,10 @@ func (self *MenuController) GetKeybindings(opts types.KeybindingsOpts) []*types. Key: opts.GetKey(opts.Config.Universal.ConfirmAlt1), Handler: self.press, }, + { + Key: opts.GetKey(opts.Config.Universal.Return), + Handler: self.close, + }, } return bindings @@ -58,6 +62,10 @@ func (self *MenuController) press() error { return nil } +func (self *MenuController) close() error { + return self.c.PopContext() +} + func (self *MenuController) Context() types.Context { return self.context() } diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 8f70045d0..cfcd50822 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -412,12 +412,6 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi Handler: self.handleCopySelectedSideContextItemToClipboard, Description: self.c.Tr.LcCopyCommitShaToClipboard, }, - { - ViewName: "menu", - Key: opts.GetKey(opts.Config.Universal.Return), - Handler: self.handleMenuClose, - Description: self.c.Tr.LcCloseMenu, - }, { ViewName: "information", Key: gocui.MouseLeft, diff --git a/pkg/gui/menu_panel.go b/pkg/gui/menu_panel.go index e787162ed..7bf68c519 100644 --- a/pkg/gui/menu_panel.go +++ b/pkg/gui/menu_panel.go @@ -18,10 +18,6 @@ func (gui *Gui) getMenuOptions() map[string]string { } } -func (gui *Gui) handleMenuClose() error { - return gui.c.PopContext() -} - // note: items option is mutated by this function func (gui *Gui) createMenu(opts types.CreateMenuOptions) error { if !opts.HideCancel { diff --git a/pkg/gui/options_menu_panel.go b/pkg/gui/options_menu_panel.go index c21a9dce3..20df7e091 100644 --- a/pkg/gui/options_menu_panel.go +++ b/pkg/gui/options_menu_panel.go @@ -70,7 +70,8 @@ func (gui *Gui) handleCreateOptionsMenu() error { if binding.Key == nil { return nil } - if err := gui.handleMenuClose(); err != nil { + + if err := gui.c.PopContext(); err != nil { return err } return binding.Handler() diff --git a/pkg/i18n/chinese.go b/pkg/i18n/chinese.go index 28d95443f..2e4c4abc9 100644 --- a/pkg/i18n/chinese.go +++ b/pkg/i18n/chinese.go @@ -347,7 +347,6 @@ func chineseTranslationSet() TranslationSet { NewBranchNamePrompt: "输入分支的新名称", RenameBranchWarning: "该分支正在跟踪远程仓库。此操作将仅会重命名本地分支名称,而不会重命名远程分支的名称。确定继续?", LcOpenMenu: "打开菜单", - LcCloseMenu: "关闭菜单", LcResetCherryPick: "重置已拣选(复制)的提交", LcNextTab: "下一个标签", LcPrevTab: "上一个标签", diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index 6cbeddbb4..7069734c9 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -302,7 +302,6 @@ func dutchTranslationSet() TranslationSet { NewBranchNamePrompt: "Noem een nieuwe branch naam", RenameBranchWarning: "Deze branch volgt een remote. Deze actie zal alleen de locale branch name wijzigen niet de naam van de remote branch. Verder gaan?", LcOpenMenu: "open menu", - LcCloseMenu: "sluit menu", LcResetCherryPick: "reset cherry-picked (gekopieerde) commits selectie", LcNextTab: "volgende tabblad", LcPrevTab: "vorige tabblad", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 02dce1416..220203437 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -332,7 +332,6 @@ type TranslationSet struct { NewGitFlowBranchPrompt string RenameBranchWarning string LcOpenMenu string - LcCloseMenu string LcResetCherryPick string LcNextTab string LcPrevTab string @@ -923,7 +922,6 @@ func EnglishTranslationSet() TranslationSet { NewBranchNamePrompt: "Enter new branch name for branch", RenameBranchWarning: "This branch is tracking a remote. This action will only rename the local branch name, not the name of the remote branch. Continue?", LcOpenMenu: "open menu", - LcCloseMenu: "close menu", LcResetCherryPick: "reset cherry-picked (copied) commits selection", LcNextTab: "next tab", LcPrevTab: "previous tab",