1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-17 01:42:45 +02:00

fix suggestions panel

This commit is contained in:
Jesse Duffield
2022-01-30 20:34:59 +11:00
parent 0a8cff6ab6
commit c703cd8f88
2 changed files with 18 additions and 5 deletions

View File

@ -230,25 +230,25 @@ func (gui *Gui) setKeyBindings(opts types.CreatePopupPanelOpts) error {
}, },
{ {
ViewName: "suggestions", ViewName: "suggestions",
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)},
Key: gui.getKey(keybindingConfig.Universal.Confirm), Key: gui.getKey(keybindingConfig.Universal.Confirm),
Handler: onSuggestionConfirm, Handler: onSuggestionConfirm,
}, },
{ {
ViewName: "suggestions", ViewName: "suggestions",
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)},
Key: gui.getKey(keybindingConfig.Universal.ConfirmAlt1), Key: gui.getKey(keybindingConfig.Universal.ConfirmAlt1),
Handler: onSuggestionConfirm, Handler: onSuggestionConfirm,
}, },
{ {
ViewName: "suggestions", ViewName: "suggestions",
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)},
Key: gui.getKey(keybindingConfig.Universal.Return), Key: gui.getKey(keybindingConfig.Universal.Return),
Handler: gui.wrappedConfirmationFunction(opts.HandlersManageFocus, opts.HandleClose), Handler: gui.wrappedConfirmationFunction(opts.HandlersManageFocus, opts.HandleClose),
}, },
{ {
ViewName: "suggestions", ViewName: "suggestions",
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)}, Contexts: []string{string(context.SUGGESTIONS_CONTEXT_KEY)},
Key: gui.getKey(keybindingConfig.Universal.TogglePanel), Key: gui.getKey(keybindingConfig.Universal.TogglePanel),
Handler: func() error { return gui.replaceContext(gui.State.Contexts.Confirmation) }, Handler: func() error { return gui.replaceContext(gui.State.Contexts.Confirmation) },
}, },

View File

@ -1496,5 +1496,18 @@ func (gui *Gui) SetKeybinding(binding *types.Binding) error {
} }
func isMouseKey(key interface{}) bool { 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
}
} }