1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Extract a function HandleGenericClick

This commit is contained in:
Stefan Haller
2024-03-27 18:37:30 +01:00
parent c59e6b6451
commit 6396d1ce03
4 changed files with 25 additions and 12 deletions

View File

@ -79,18 +79,7 @@ func (self *StatusController) GetMouseKeybindings(opts types.KeybindingsOpts) []
}
func (self *StatusController) onClickMain(opts gocui.ViewMouseBindingOpts) error {
view := self.c.Views().Main
cx, cy := view.Cursor()
url, err := view.Word(cx, cy)
if err == nil && strings.HasPrefix(url, "https://") {
// Ignore errors (opening the link via the OS can fail if the
// `os.openLink` config key references a command that doesn't exist, or
// that errors when called.)
_ = self.c.OS().OpenLink(url)
}
return nil
return self.c.HandleGenericClick(self.c.Views().Main)
}
func (self *StatusController) GetOnRenderToMain() func() error {