mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-17 01:42:45 +02:00
Allow clicking in the respective other main view to switch focus to it
This commit is contained in:
@ -58,7 +58,19 @@ func (self *MainViewController) GetMouseKeybindings(opts types.KeybindingsOpts)
|
|||||||
{
|
{
|
||||||
ViewName: self.context.GetViewName(),
|
ViewName: self.context.GetViewName(),
|
||||||
Key: gocui.MouseLeft,
|
Key: gocui.MouseLeft,
|
||||||
Handler: self.onClick,
|
Handler: func(opts gocui.ViewMouseBindingOpts) error {
|
||||||
|
if self.isFocused() {
|
||||||
|
return self.onClick(opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
self.context.SetParentContext(self.otherContext.GetParentContext())
|
||||||
|
self.c.Context().Push(self.context, types.OnFocusOpts{
|
||||||
|
ClickedWindowName: self.context.GetWindowName(),
|
||||||
|
ClickedViewLineIdx: opts.Y,
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,3 +112,7 @@ func (self *MainViewController) openSearch() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *MainViewController) isFocused() bool {
|
||||||
|
return self.c.Context().Current().GetKey() == self.context.GetKey()
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user