1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

fix click handling

This commit is contained in:
Jesse Duffield
2022-02-27 11:42:22 +11:00
parent cf00949b85
commit 59d4df2a44
52 changed files with 499 additions and 259 deletions

View File

@ -70,9 +70,10 @@ func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []
func (self *CommitFilesController) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding {
return []*gocui.ViewMouseBinding{
{
ViewName: "main",
Key: gocui.MouseLeft,
Handler: self.onClickMain,
ViewName: "main",
Key: gocui.MouseLeft,
Handler: self.onClickMain,
FromContext: string(self.context().GetKey()),
},
}
}
@ -97,12 +98,11 @@ func (self *CommitFilesController) context() *context.CommitFilesContext {
}
func (self *CommitFilesController) onClickMain(opts gocui.ViewMouseBindingOpts) error {
clickedViewLineIdx := opts.Cy + opts.Oy
node := self.context().GetSelectedFileNode()
if node == nil {
return nil
}
return self.enterCommitFile(node, types.OnFocusOpts{ClickedViewName: "main", ClickedViewLineIdx: clickedViewLineIdx})
return self.enterCommitFile(node, types.OnFocusOpts{ClickedViewName: "main", ClickedViewLineIdx: opts.Y})
}
func (self *CommitFilesController) checkout(node *filetree.CommitFileNode) error {