Dont make urls part of styling, instead have a dedicated UrlFunc API

Since urls can potentially change a lot, caching them makes no sense
This commit is contained in:
Kovid Goyal
2022-08-28 10:12:35 +05:30
parent be22f49012
commit 4a4500d56b
3 changed files with 26 additions and 7 deletions

View File

@@ -298,7 +298,6 @@ func (self *sgr_code) update() {
func parse_spec(spec string) []escape_code {
ans := make([]escape_code, 0, 1)
sgr := sgr_code{}
url := url_code{}
sparts, _ := shlex.Split(spec)
for _, p := range sparts {
parts := strings.SplitN(p, "=", 2)
@@ -326,17 +325,12 @@ func parse_spec(spec string) []escape_code {
sgr.underline.from_string(val)
case "ucol", "underline_color", "uc":
sgr.uc.from_string(val)
case "url":
url.url = val
}
}
sgr.update()
if !sgr.is_empty() {
ans = append(ans, &sgr)
}
if !url.is_empty() {
ans = append(ans, &url)
}
return ans
}