From c703cd8f88bfac616cf6bc8a5f8eea41363ddfae Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 30 Jan 2022 20:34:59 +1100 Subject: [PATCH] fix suggestions panel --- pkg/gui/confirmation_panel.go | 8 ++++---- pkg/gui/keybindings.go | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index d136b7d7f..8ed16ea39 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -230,25 +230,25 @@ func (gui *Gui) setKeyBindings(opts types.CreatePopupPanelOpts) error { }, { ViewName: "suggestions", - Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, + Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)}, Key: gui.getKey(keybindingConfig.Universal.Confirm), Handler: onSuggestionConfirm, }, { ViewName: "suggestions", - Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, + Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)}, Key: gui.getKey(keybindingConfig.Universal.ConfirmAlt1), Handler: onSuggestionConfirm, }, { ViewName: "suggestions", - Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, + Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)}, Key: gui.getKey(keybindingConfig.Universal.Return), Handler: gui.wrappedConfirmationFunction(opts.HandlersManageFocus, opts.HandleClose), }, { ViewName: "suggestions", - Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, + Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)}, Key: gui.getKey(keybindingConfig.Universal.TogglePanel), Handler: func() error { return gui.replaceContext(gui.State.Contexts.Confirmation) }, }, diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 123e6f5b5..e6ba31923 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -1496,5 +1496,18 @@ func (gui *Gui) SetKeybinding(binding *types.Binding) error { } func isMouseKey(key interface{}) bool { - return key == gocui.MouseLeft || key == gocui.MouseRight || key == gocui.MouseMiddle || key == gocui.MouseRelease || key == gocui.MouseWheelUp || key == gocui.MouseWheelDown || key == gocui.MouseWheelLeft || key == gocui.MouseWheelRight + switch key { + case + gocui.MouseLeft, + gocui.MouseRight, + gocui.MouseMiddle, + gocui.MouseRelease, + gocui.MouseWheelUp, + gocui.MouseWheelDown, + gocui.MouseWheelLeft, + gocui.MouseWheelRight: + return true + default: + return false + } }