commit d242b4f

delthas  ·  2022-10-14 09:19:42 +0000 UTC
parent 0bef742
Switch to the upstream tcell implementation of OSC 8 hyperlink

tcell has merged OSC support in [1], with support for more terminals
than what was added in the tcell fork we used.

Now, all terminals with mouse sequences support should receive OSC 8
hyperlinks sequences.

[1]: https://github.com/gdamore/tcell/pull/527/commits/e7b14a71dc78721c0f007fd6197262c52c1d4df9
Fixes: https://todo.sr.ht/~taiite/senpai/103
3 files changed,  +9, -11
M go.mod
M go.sum
M go.mod
+1, -3
 1@@ -4,12 +4,10 @@ go 1.16
 2 
 3 require (
 4 	git.sr.ht/~emersion/go-scfg v0.0.0-20201019143924-142a8aa629fc
 5-	github.com/gdamore/tcell/v2 v2.3.11
 6+	github.com/gdamore/tcell/v2 v2.5.4-0.20220911202027-96bb70f9efec
 7 	github.com/mattn/go-runewidth v0.0.13
 8 	golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
 9 	golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
10 	golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6
11 	mvdan.cc/xurls/v2 v2.3.0
12 )
13-
14-replace github.com/gdamore/tcell/v2 => github.com/delthas/tcell/v2 v2.4.1-0.20220223131437-2362f49a2b6c
M go.sum
+4, -4
 1@@ -2,10 +2,10 @@ git.sr.ht/~emersion/go-scfg v0.0.0-20201019143924-142a8aa629fc h1:51BD67xFX+bozd
 2 git.sr.ht/~emersion/go-scfg v0.0.0-20201019143924-142a8aa629fc/go.mod h1:t+Ww6SR24yYnXzEWiNlOY0AFo5E9B73X++10lrSpp4U=
 3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 4 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 5-github.com/delthas/tcell/v2 v2.4.1-0.20220223131437-2362f49a2b6c h1:CDBsRiU7tJJ5zD38/jHNShfWFJP2lctZF7v0z1ASrtg=
 6-github.com/delthas/tcell/v2 v2.4.1-0.20220223131437-2362f49a2b6c/go.mod h1:Az6Jt+M5idSED2YPGtwnfJV0kXohgdCBPmHGSYc1r04=
 7 github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
 8 github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
 9+github.com/gdamore/tcell/v2 v2.5.4-0.20220911202027-96bb70f9efec h1:wvcbNOhEpZhHp4F9eIvB7fn0CDsQt9EXlHHyvxfb284=
10+github.com/gdamore/tcell/v2 v2.5.4-0.20220911202027-96bb70f9efec/go.mod h1:wSkrPaXoiIWZqW/g7Px4xc79di6FTcpB8tvaKJ6uGBo=
11 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
12 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
13 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
14@@ -23,13 +23,13 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacp
15 golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
16 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
17 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
18-golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
19 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
20+golang.org/x/sys v0.0.0-20220318055525-2edf467146b5 h1:saXMvIOKvRFwbOMicHXr0B1uwoxq9dGmLe5ExMES6c4=
21+golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
22 golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
23 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
24 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
25 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
26-golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
27 golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
28 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
29 golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 h1:Vv0JUPWTyeqUq42B2WJ1FeIDjjvGKoA2Ss+Ts0lAVbs=
+4, -4
 1@@ -149,7 +149,7 @@ func (s StyledString) ParseURLs() StyledString {
 2 			}
 3 			if st.Start == ub {
 4 				// a style already starts at this position, edit it
 5-				lastStyle.Style = lastStyle.Style.Hyperlink(link)
 6+				lastStyle.Style = lastStyle.Style.Url(link)
 7 			}
 8 			lastStyle = st
 9 			styles = append(styles, st)
10@@ -158,7 +158,7 @@ func (s StyledString) ParseURLs() StyledString {
11 			// no style existed at this position, add one from the last style
12 			styles = append(styles, rangedStyle{
13 				Start: ub,
14-				Style: lastStyle.Style.Hyperlink(link),
15+				Style: lastStyle.Style.Url(link),
16 			})
17 		}
18 		// find last style starting before or at url end
19@@ -168,7 +168,7 @@ func (s StyledString) ParseURLs() StyledString {
20 				break
21 			}
22 			if st.Start < ue {
23-				st.Style = st.Style.Hyperlink(link)
24+				st.Style = st.Style.Url(link)
25 			}
26 			lastStyle = st
27 			styles = append(styles, st)
28@@ -177,7 +177,7 @@ func (s StyledString) ParseURLs() StyledString {
29 			// no style existed at this position, add one from the last style without the hyperlink
30 			styles = append(styles, rangedStyle{
31 				Start: ue,
32-				Style: lastStyle.Style.Hyperlink(""),
33+				Style: lastStyle.Style.Url(""),
34 			})
35 		}
36 	}