File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,19 @@ func (self *MainViewController) GetMouseKeybindings(opts types.KeybindingsOpts)
55
55
{
56
56
ViewName : self .context .GetViewName (),
57
57
Key : gocui .MouseLeft ,
58
- Handler : self .onClick ,
58
+ Handler : func (opts gocui.ViewMouseBindingOpts ) error {
59
+ if self .isFocused () {
60
+ return self .onClick (opts )
61
+ }
62
+
63
+ self .context .SetParentContext (self .otherContext .GetParentContext ())
64
+ self .c .Context ().Push (self .context , types.OnFocusOpts {
65
+ ClickedWindowName : self .context .GetWindowName (),
66
+ ClickedViewLineIdx : opts .Y ,
67
+ })
68
+
69
+ return nil
70
+ },
59
71
},
60
72
}
61
73
}
@@ -105,3 +117,7 @@ func (self *MainViewController) onClick(opts gocui.ViewMouseBindingOpts) error {
105
117
}
106
118
return nil
107
119
}
120
+
121
+ func (self * MainViewController ) isFocused () bool {
122
+ return self .c .Context ().Current ().GetKey () == self .context .GetKey ()
123
+ }
You can’t perform that action at this time.
0 commit comments