Skip to content

Commit

Permalink
perf: use uniseg.StringWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Jan 22, 2024
1 parent 9850e56 commit 66fb03a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions go.mod
Expand Up @@ -6,8 +6,6 @@ require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1
github.com/lucasb-eyer/go-colorful v1.2.0
github.com/mattn/go-isatty v0.0.19
github.com/mattn/go-runewidth v0.0.14
github.com/rivo/uniseg v0.4.4
golang.org/x/sys v0.10.0
)

require github.com/rivo/uniseg v0.2.0 // indirect
6 changes: 2 additions & 4 deletions go.sum
Expand Up @@ -4,10 +4,8 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4 changes: 2 additions & 2 deletions style.go
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"github.com/mattn/go-runewidth"
"github.com/rivo/uniseg"
)

// Sequence definitions.
Expand Down Expand Up @@ -122,5 +122,5 @@ func (t Style) CrossOut() Style {

// Width returns the width required to print all runes in Style.
func (t Style) Width() int {
return runewidth.StringWidth(t.string)
return uniseg.StringWidth(t.string)
}

0 comments on commit 66fb03a

Please sign in to comment.