From b3a3410a1a98aa334bdf58ac7a695d4403281371 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 15 Aug 2025 18:12:44 +0200 Subject: [PATCH] Remove keybindings for menu items that are the same as the menu confirm key This is needed when remapping the confirmMenu key to, say, "y", and there's a menu that has an item with a "y" binding. This already worked correctly (confirm takes precedence, as desired), but it's still confusing to see the item binding. --- pkg/gui/menu_panel.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/gui/menu_panel.go b/pkg/gui/menu_panel.go index b0e69cfe0..ddd45f97e 100644 --- a/pkg/gui/menu_panel.go +++ b/pkg/gui/menu_panel.go @@ -3,6 +3,7 @@ package gui import ( "fmt" + "github.com/jesseduffield/lazygit/pkg/gui/keybindings" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/theme" ) @@ -20,6 +21,7 @@ func (gui *Gui) createMenu(opts types.CreateMenuOptions) error { } maxColumnSize := 1 + confirmKey := keybindings.GetKey(gui.c.UserConfig().Keybinding.Universal.ConfirmMenu) for _, item := range opts.Items { if item.LabelColumns == nil { @@ -31,6 +33,11 @@ func (gui *Gui) createMenu(opts types.CreateMenuOptions) error { } maxColumnSize = max(maxColumnSize, len(item.LabelColumns)) + + // Remove all item keybindings that are the same as the confirm binding + if item.Key == confirmKey { + item.Key = nil + } } for _, item := range opts.Items {