mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Use our new hyperlink support in the information view
This commit is contained in:
@ -14,8 +14,8 @@ func (gui *Gui) informationStr() string {
|
||||
}
|
||||
|
||||
if gui.g.Mouse {
|
||||
donate := style.FgMagenta.SetUnderline().Sprint(gui.c.Tr.Donate)
|
||||
askQuestion := style.FgYellow.SetUnderline().Sprint(gui.c.Tr.AskQuestion)
|
||||
donate := style.FgMagenta.Sprint(style.PrintHyperlink(gui.c.Tr.Donate, constants.Links.Donate))
|
||||
askQuestion := style.FgYellow.Sprint(style.PrintHyperlink(gui.c.Tr.AskQuestion, constants.Links.Discussions))
|
||||
return fmt.Sprintf("%s %s %s", donate, askQuestion, gui.Config.GetVersion())
|
||||
} else {
|
||||
return gui.Config.GetVersion()
|
||||
@ -39,28 +39,5 @@ func (gui *Gui) handleInfoClick() error {
|
||||
return activeMode.Reset()
|
||||
}
|
||||
|
||||
var title, url string
|
||||
|
||||
// if we're not in an active mode we show the donate button
|
||||
if cx <= utils.StringWidth(gui.c.Tr.Donate) {
|
||||
url = constants.Links.Donate
|
||||
title = gui.c.Tr.Donate
|
||||
} else if cx <= utils.StringWidth(gui.c.Tr.Donate)+1+utils.StringWidth(gui.c.Tr.AskQuestion) {
|
||||
url = constants.Links.Discussions
|
||||
title = gui.c.Tr.AskQuestion
|
||||
}
|
||||
err := gui.os.OpenLink(url)
|
||||
if err != nil {
|
||||
// Opening the link via the OS failed for some reason. (For example, this
|
||||
// can happen if the `os.openLink` config key references a command that
|
||||
// doesn't exist, or that errors when called.)
|
||||
//
|
||||
// In that case, rather than crash the app, fall back to simply showing a
|
||||
// dialog asking the user to visit the URL.
|
||||
placeholders := map[string]string{"url": url}
|
||||
message := utils.ResolvePlaceholderString(gui.c.Tr.PleaseGoToURL, placeholders)
|
||||
return gui.c.Alert(title, message)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user