Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/gui/controllers/helpers/confirmation_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func underlineLinks(text string) string {
} else {
linkEnd += linkStart
}
underlinedLink := style.PrintSimpleHyperlink(remaining[linkStart:linkEnd])
underlinedLink := style.PrintSimpleHyperlink(remaining[linkStart:linkEnd], true)
result += remaining[:linkStart] + underlinedLink
remaining = remaining[linkEnd:]
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/gui/controllers/status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ func (self *StatusController) showDashboard() error {
[]string{
lazygitTitle(),
fmt.Sprintf("Copyright %d Jesse Duffield", time.Now().Year()),
fmt.Sprintf("Keybindings: %s", style.PrintSimpleHyperlink(fmt.Sprintf(constants.Links.Docs.Keybindings, versionStr))),
fmt.Sprintf("Config Options: %s", style.PrintSimpleHyperlink(fmt.Sprintf(constants.Links.Docs.Config, versionStr))),
fmt.Sprintf("Tutorial: %s", style.PrintSimpleHyperlink(constants.Links.Docs.Tutorial)),
fmt.Sprintf("Raise an Issue: %s", style.PrintSimpleHyperlink(constants.Links.Issues)),
fmt.Sprintf("Release Notes: %s", style.PrintSimpleHyperlink(constants.Links.Releases)),
style.FgMagenta.Sprintf("Become a sponsor: %s", style.PrintSimpleHyperlink(constants.Links.Donate)), // caffeine ain't free
fmt.Sprintf("Keybindings: %s", style.PrintSimpleHyperlink(fmt.Sprintf(constants.Links.Docs.Keybindings, versionStr), true)),
fmt.Sprintf("Config Options: %s", style.PrintSimpleHyperlink(fmt.Sprintf(constants.Links.Docs.Config, versionStr), true)),
fmt.Sprintf("Tutorial: %s", style.PrintSimpleHyperlink(constants.Links.Docs.Tutorial, true)),
fmt.Sprintf("Raise an Issue: %s", style.PrintSimpleHyperlink(constants.Links.Issues, true)),
fmt.Sprintf("Release Notes: %s", style.PrintSimpleHyperlink(constants.Links.Releases, true)),
style.FgMagenta.Sprintf("Become a sponsor: %s", style.PrintSimpleHyperlink(constants.Links.Donate, true)), // caffeine ain't free
}, "\n\n") + "\n"

return self.c.RenderToMainViews(types.RefreshMainOpts{
Expand Down
4 changes: 2 additions & 2 deletions pkg/gui/information_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func (gui *Gui) informationStr() string {
}

if gui.g.Mouse {
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))
donate := style.FgMagenta.Sprint(style.PrintHyperlink(gui.c.Tr.Donate, constants.Links.Donate, true))
askQuestion := style.FgYellow.Sprint(style.PrintHyperlink(gui.c.Tr.AskQuestion, constants.Links.Discussions, true))
return fmt.Sprintf("%s %s %s", donate, askQuestion, gui.Config.GetVersion())
} else {
return gui.Config.GetVersion()
Expand Down
16 changes: 12 additions & 4 deletions pkg/gui/style/hyperlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ package style
import "fmt"

// Render the given text as an OSC 8 hyperlink
func PrintHyperlink(text string, link string) string {
return fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", link, text)
func PrintHyperlink(text string, link string, underline bool) string {
result := fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", link, text)
if underline {
return AttrUnderline.Sprint(result)
}
return result
}

// Render a link where the text is the same as a link
func PrintSimpleHyperlink(link string) string {
return fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", link, link)
func PrintSimpleHyperlink(link string, underline bool) string {
result := fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", link, link)
if underline {
return AttrUnderline.Sprint(result)
}
return result
}
6 changes: 5 additions & 1 deletion pkg/utils/color_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ func TestDecolorise(t *testing.T) {
output: "ta",
},
{
input: "a_" + style.PrintSimpleHyperlink("xyz") + "_b",
input: "a_" + style.PrintSimpleHyperlink("xyz", true) + "_b",
output: "a_xyz_b",
},
{
input: "a_" + style.PrintSimpleHyperlink("xyz", false) + "_b",
output: "a_xyz_b",
},
}
Expand Down
17 changes: 16 additions & 1 deletion vendor/github.com/jesseduffield/gocui/gui.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion vendor/github.com/jesseduffield/gocui/tcell_driver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 88 additions & 6 deletions vendor/github.com/jesseduffield/gocui/view.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.