File tree Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package controllers
3
3
import (
4
4
"fmt"
5
5
6
+ "github.com/jesseduffield/gocui"
6
7
"github.com/jesseduffield/lazygit/pkg/gui/context"
7
8
"github.com/jesseduffield/lazygit/pkg/gui/types"
8
9
)
@@ -51,6 +52,22 @@ func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) [
51
52
return bindings
52
53
}
53
54
55
+ func (self * ConfirmationController ) GetMouseKeybindings (opts types.KeybindingsOpts ) []* gocui.ViewMouseBinding {
56
+ return []* gocui.ViewMouseBinding {
57
+ {
58
+ ViewName : self .c .Contexts ().Suggestions .GetViewName (),
59
+ FocusedView : self .c .Contexts ().Confirmation .GetViewName (),
60
+ Key : gocui .MouseLeft ,
61
+ Handler : func (gocui.ViewMouseBindingOpts ) error {
62
+ self .switchToSuggestions ()
63
+ // Let it fall through to the ListController's click handler so that
64
+ // the clicked line gets selected:
65
+ return gocui .ErrKeybindingNotHandled
66
+ },
67
+ },
68
+ }
69
+ }
70
+
54
71
func (self * ConfirmationController ) GetOnFocusLost () func (types.OnFocusLostOpts ) {
55
72
return func (types.OnFocusLostOpts ) {
56
73
self .c .Helpers ().Confirmation .DeactivateConfirmationPrompt ()
Original file line number Diff line number Diff line change 1
1
package controllers
2
2
3
3
import (
4
+ "github.com/jesseduffield/gocui"
4
5
"github.com/jesseduffield/lazygit/pkg/gui/context"
5
6
"github.com/jesseduffield/lazygit/pkg/gui/types"
6
7
)
@@ -69,6 +70,19 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
69
70
return bindings
70
71
}
71
72
73
+ func (self * SuggestionsController ) GetMouseKeybindings (opts types.KeybindingsOpts ) []* gocui.ViewMouseBinding {
74
+ return []* gocui.ViewMouseBinding {
75
+ {
76
+ ViewName : self .c .Contexts ().Confirmation .GetViewName (),
77
+ FocusedView : self .c .Contexts ().Suggestions .GetViewName (),
78
+ Key : gocui .MouseLeft ,
79
+ Handler : func (gocui.ViewMouseBindingOpts ) error {
80
+ return self .switchToConfirmation ()
81
+ },
82
+ },
83
+ }
84
+ }
85
+
72
86
func (self * SuggestionsController ) switchToConfirmation () error {
73
87
self .c .Views ().Suggestions .Subtitle = ""
74
88
self .c .Views ().Suggestions .Highlight = false
Original file line number Diff line number Diff line change @@ -508,11 +508,13 @@ func (gui *Gui) SetMouseKeybinding(binding *gocui.ViewMouseBinding) error {
508
508
! gocui .IsMouseScrollKey (opts .Key ) {
509
509
// we ignore click events on views that aren't popup panels, when a popup panel is focused.
510
510
// Unless both the current view and the clicked-on view are either commit message or commit
511
- // description, because we want to allow switching between those two views by clicking.
512
- isCommitMessageView := func (viewName string ) bool {
513
- return viewName == "commitMessage" || viewName == "commitDescription"
511
+ // description, or a confirmation and the suggestions view, because we want to allow switching
512
+ // between those two views by clicking.
513
+ isCommitMessageOrSuggestionsView := func (viewName string ) bool {
514
+ return viewName == "commitMessage" || viewName == "commitDescription" ||
515
+ viewName == "confirmation" || viewName == "suggestions"
514
516
}
515
- if ! isCommitMessageView (gui .currentViewName ()) || ! isCommitMessageView (binding .ViewName ) {
517
+ if ! isCommitMessageOrSuggestionsView (gui .currentViewName ()) || ! isCommitMessageOrSuggestionsView (binding .ViewName ) {
516
518
return nil
517
519
}
518
520
}
You can’t perform that action at this time.
0 commit comments