diff options
author | delthas <delthas@dille.cc> | 2022-03-29 15:35:38 +0200 |
---|---|---|
committer | delthas <delthas@dille.cc> | 2022-03-29 15:36:20 +0200 |
commit | dcaf0b6a39fb819923bb0ff94060dcbe8a863eb5 (patch) | |
tree | e3890fb1389fe0e9ea4d920123c1723cdd766d72 /ui | |
parent | Drain the events channel when closing (diff) |
Add HTTPS schema by default to hyperlinks
Diffstat (limited to 'ui')
-rw-r--r-- | ui/style.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/style.go b/ui/style.go index 4552020..d3869c1 100644 --- a/ui/style.go +++ b/ui/style.go @@ -2,6 +2,7 @@ package ui import ( "fmt" + "net/url" "strconv" "strings" "unicode/utf8" @@ -137,6 +138,9 @@ func (s StyledString) ParseURLs() StyledString { u := urls[i] ub, ue := u[0], u[1] link := s.string[u[0]:u[1]] + if u, err := url.Parse(link); err != nil || u.Scheme == "" { + link = "https://" + link + } // find last style starting before or at url begin for ; j < len(s.styles); j++ { st := s.styles[j] |