chore: ⬆️ updated deps

This commit is contained in:
2026-05-20 22:52:20 +02:00
parent d9f27c1775
commit 43f4680176
374 changed files with 295527 additions and 301467 deletions
+42 -2
View File
@@ -14,6 +14,11 @@
package tcell
import (
"strings"
"unicode/utf8"
)
// Style represents a complete text style, including both foreground color,
// background color, and additional attributes such as "bold" or "underline".
//
@@ -164,6 +169,16 @@ func (s Style) Underline(params ...interface{}) Style {
return s2
}
// GetUnderlineStyle returns the underline style for the style.
func (s Style) GetUnderlineStyle() UnderlineStyle {
return s.ulStyle
}
// GetUnderlineColor returns the underline color for the style.
func (s Style) GetUnderlineColor() Color {
return s.ulColor
}
// Attributes returns a new style based on s, with its attributes set as
// specified.
func (s Style) Attributes(attrs AttrMask) Style {
@@ -177,7 +192,7 @@ func (s Style) Attributes(attrs AttrMask) Style {
// link to that Url. If the Url is empty, then this mode is turned off.
func (s Style) Url(url string) Style {
s2 := s
s2.url = url
s2.url = stripOSCControls(url)
return s2
}
@@ -187,6 +202,31 @@ func (s Style) Url(url string) Style {
// were one Url, even if it spans multiple lines.
func (s Style) UrlId(id string) Style {
s2 := s
s2.urlId = "id=" + id
s2.urlId = "id=" + stripOSCControls(id)
return s2
}
func stripOSCControls(s string) string {
var b strings.Builder
b.Grow(len(s))
for i := 0; i < len(s); {
r, size := utf8.DecodeRuneInString(s[i:])
if r == utf8.RuneError && size == 1 {
c := s[i]
if c <= 0x1f || c == 0x7f || (c >= 0x80 && c <= 0x9f) {
i++
continue
}
_ = b.WriteByte(c)
i++
continue
}
if r <= 0x1f || r == 0x7f || (r >= 0x80 && r <= 0x9f) {
i += size
continue
}
b.WriteString(s[i : i+size])
i += size
}
return b.String()
}