Skip to content

Commit

Permalink
refactor(cellbuf): revert back to mattn/go-runewidth
Browse files Browse the repository at this point in the history
Our in-house wcwidth package is still unstable. Revert back to
go-runewidth
  • Loading branch information
aymanbagabas committed Jan 17, 2025
1 parent 19589e2 commit 40ce9b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cellbuf/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package cellbuf
import (
"strings"

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

// NewCell returns a new cell. This is a convenience function that initializes a
// new cell with the given content. The cell's width is determined by the
// content using [wcwidth.RuneWidth].
func NewCell(r rune, comb ...rune) *Cell {
width := wcwidth.StringWidth(string(append([]rune{r}, comb...)))
width := runewidth.StringWidth(string(append([]rune{r}, comb...)))
return &Cell{
Rune: r,
Comb: comb,
Expand All @@ -31,10 +31,10 @@ func NewCellString(s string) *Cell {
for i, c := range s {
if i == 0 {
r = c
w = wcwidth.RuneWidth(c)
w = runewidth.RuneWidth(c)
continue
}
if wcwidth.RuneWidth(c) > 0 {
if runewidth.RuneWidth(c) > 0 {
break
}
comb = append(comb, c)
Expand Down

0 comments on commit 40ce9b2

Please sign in to comment.