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)
5555 {
5656 ViewName : self .context .GetViewName (),
5757 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+ },
5971 },
6072 }
6173}
@@ -105,3 +117,7 @@ func (self *MainViewController) onClick(opts gocui.ViewMouseBindingOpts) error {
105117 }
106118 return nil
107119}
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