mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-11 11:42:12 +02:00
Add function to render a hyperlink
It might seem cleaner to integrate this into the text style system, so that you could say `ts := ts.Url("some link")` and then `ts.Sprint("my text")`. However, this would require adding a new field to TextStyle, which I didn't want to do.
This commit is contained in:
parent
fb81fc6057
commit
3f7674a2e9
13
pkg/gui/style/hyperlink.go
Normal file
13
pkg/gui/style/hyperlink.go
Normal file
@ -0,0 +1,13 @@
|
||||
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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user