1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-09-16 09:16:26 +02:00

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.
This commit is contained in:
Stefan Haller
2025-08-15 18:12:44 +02:00
parent b413710d8c
commit b3a3410a1a

View File

@@ -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 {