mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Allow clicking in the respective other main view to switch focus to it
This commit is contained in:
parent
fbb8b2e17e
commit
98e4cb733f
1 changed files with 17 additions and 1 deletions
|
@ -58,7 +58,19 @@ func (self *MainViewController) GetMouseKeybindings(opts types.KeybindingsOpts)
|
|||
{
|
||||
ViewName: self.context.GetViewName(),
|
||||
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
|
||||
}
|
||||
|
||||
func (self *MainViewController) isFocused() bool {
|
||||
return self.c.Context().Current().GetKey() == self.context.GetKey()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue