Files
Stefan Haller 3d18ee8f91 Use a slice of keys for each binding
This is a pure refactor in preparation for letting users configure multiple
alternate bindings for a single command. Every Binding still has exactly one
key, so nothing changes visibly: the cheatsheet, the on-screen options bar,
and the keybindings menu all render identically.

When a Binding ends up with multiple keys, the on-screen options bar will
show only the first (to avoid clutter); the cheatsheet will show all of them (in
a later commit). For now both paths take Key[0].

MenuItem.Key is changed in the same way, it also has a slice of keys now.

In this commit we keep the name `Key` in Binding, KeybindingOpts and MenuItem,
instead of renaming them to `Keys` right away, in order to keep the diff a bit
more readable. We'll do the rename separately in the next commit.
2026-05-25 15:18:18 +02:00

12 lines
469 B
Go

package controllers
import "github.com/jesseduffield/lazygit/pkg/gocui"
// menuKey is a shorthand for constructing a key value for a menu item from a single rune literal,
// avoiding the noise of `[]gocui.Key{gocui.NewKeyRune('a')}` at every call site. There is an
// intentionally identical helper in the helpers package so that callers in either package can use
// the unqualified form.
func menuKey(r rune) []gocui.Key {
return []gocui.Key{gocui.NewKeyRune(r)}
}