Skip to content

Commit 26096d9

Browse files
committed
Don't hide keybindings that match the confirmMenu key in the keybindings menu
In all other menus besides the keybindings menu it makes sense to hide keybindings that match the confirmMenu binding. This is important to make it clear which action will be triggered when you press the key. In the keybindings menu this is different; the main purpose of that menu is not to allow triggering commands by their key while the menu is open, but to serve as a reference for what the keybindings are when it is not open. Because of this, it is more important to show all bindings in this menu, even if they conflict with the confirmMenu key. This fixes a regression introduced in b3a3410.
1 parent 0d5a410 commit 26096d9

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

pkg/gui/controllers/options_menu_action.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func (self *OptionsMenuAction) Call() error {
5151
HideCancel: true,
5252
ColumnAlignment: []utils.Alignment{utils.AlignRight, utils.AlignLeft},
5353
AllowFilteringKeybindings: true,
54+
KeepConfirmKeybindings: true,
5455
})
5556
}
5657

pkg/gui/menu_panel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (gui *Gui) createMenu(opts types.CreateMenuOptions) error {
3535
maxColumnSize = max(maxColumnSize, len(item.LabelColumns))
3636

3737
// Remove all item keybindings that are the same as the confirm binding
38-
if item.Key == confirmKey {
38+
if item.Key == confirmKey && !opts.KeepConfirmKeybindings {
3939
item.Key = nil
4040
}
4141
}

pkg/gui/types/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ type CreateMenuOptions struct {
156156
HideCancel bool
157157
ColumnAlignment []utils.Alignment
158158
AllowFilteringKeybindings bool
159+
KeepConfirmKeybindings bool // if true, the keybindings that match the confirm binding will not be removed from menu items
159160
}
160161

161162
type CreatePopupPanelOpts struct {

0 commit comments

Comments
 (0)