Merge pull request #7287 from thaJeztah/bump_runewidth

vendor: github.com/mattn/go-runewidth v0.0.29
This commit is contained in:
Paweł Gronowski
2026-09-04 14:40:50 +02:00
committed by GitHub
4 changed files with 22 additions and 10 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ require (
github.com/google/go-cmp v0.7.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/google/uuid v1.6.0
github.com/mattn/go-runewidth v0.0.28
github.com/mattn/go-runewidth v0.0.29
github.com/moby/go-archive v0.3.3
github.com/moby/moby/api v1.56.0
github.com/moby/moby/client v0.6.0
+2 -2
View File
@@ -82,8 +82,8 @@ github.com/klauspost/compress v1.19.2 h1:hMRETovs/pu/dVWN7zIT1PGG8t509MwT6bO7XSi
github.com/klauspost/compress v1.19.2/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/mattn/go-runewidth v0.0.28 h1:rPyg2ybwEKPebvpzVWe1gKBkH8EQFkxO4Y0hjBeLaBU=
github.com/mattn/go-runewidth v0.0.28/go.mod h1:3qAiGCV4Koz/yuveO58qUefmUTRm8r0IGEXZ9jeHp/8=
github.com/mattn/go-runewidth v0.0.29 h1:3oGF3R/S2N9DQ3ptftzVIvg2eicmojCzlwBEmqEPDfQ=
github.com/mattn/go-runewidth v0.0.29/go.mod h1:3qAiGCV4Koz/yuveO58qUefmUTRm8r0IGEXZ9jeHp/8=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/go-archive v0.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME=
+18 -6
View File
@@ -147,7 +147,6 @@ func handleEnv() {
if DefaultCondition.EastAsianWidth != EastAsianWidth {
DefaultCondition.EastAsianWidth = EastAsianWidth
if len(DefaultCondition.combinedLut) > 0 {
DefaultCondition.combinedLut = DefaultCondition.combinedLut[:0]
CreateLUT()
}
}
@@ -355,7 +354,12 @@ var nonprint = table{
// Condition have flag EastAsianWidth whether the current locale is CJK or not.
type Condition struct {
combinedLut []byte
combinedLut []byte
// The flags combinedLut was built from, so that CreateLUT can tell a
// table that is still current from one that has to be rebuilt.
lutEastAsianWidth bool
lutStrictEmojiNeutral bool
EastAsianWidth bool
StrictEmojiNeutral bool
@@ -421,6 +425,11 @@ func (c *Condition) CreateLUT() {
const max = 0x110000
lut := c.combinedLut
if len(c.combinedLut) != 0 {
if c.lutEastAsianWidth == c.EastAsianWidth && c.lutStrictEmojiNeutral == c.StrictEmojiNeutral {
// The table still matches the flags, so rebuilding it
// would produce the same bytes.
return
}
// Remove so we don't use it.
c.combinedLut = nil
} else {
@@ -433,6 +442,8 @@ func (c *Condition) CreateLUT() {
lut[i] = uint8(x0) | uint8(x1)<<4
}
c.combinedLut = lut
c.lutEastAsianWidth = c.EastAsianWidth
c.lutStrictEmojiNeutral = c.StrictEmojiNeutral
}
// graphemeWidth returns the width of a single grapheme cluster: the sum of
@@ -566,7 +577,9 @@ func (c *Condition) TruncatePrefix(s string, w int, prefix string) string {
func (c *Condition) Wrap(s string, w int) string {
width := 0
var out strings.Builder
out.Grow(len(s) + len(s)/w + 1)
// max keeps the capacity hint from dividing by zero when w is 0; a
// non-positive width breaks before every rune, as it always has.
out.Grow(len(s) + len(s)/max(w, 1) + 1)
for _, r := range s {
cw := c.RuneWidth(r)
if r == '\n' {
@@ -664,9 +677,8 @@ func FillRight(s string, w int) string {
// CreateLUT will create an in-memory lookup table of 557055 bytes for faster operation.
// This should not be called concurrently with other operations.
// If flags in DefaultCondition are changed, CreateLUT should be called again;
// a call that finds the table already current is a no-op.
func CreateLUT() {
if len(DefaultCondition.combinedLut) > 0 {
return
}
DefaultCondition.CreateLUT()
}
+1 -1
View File
@@ -156,7 +156,7 @@ github.com/klauspost/compress/internal/le
github.com/klauspost/compress/internal/snapref
github.com/klauspost/compress/zstd
github.com/klauspost/compress/zstd/internal/xxhash
# github.com/mattn/go-runewidth v0.0.28
# github.com/mattn/go-runewidth v0.0.29
## explicit; go 1.23
github.com/mattn/go-runewidth
# github.com/moby/docker-image-spec v1.3.1