This is an extended version of text/tabwriter.
Compared with the official version, it uses mattn/go-runewidth to calculate the variable width of unicode characters to adds more support to most (but not all) Chinese/Japanese/Korean characters, emojis, "fullwidth" Latin characters, etc.
Since the official version is already frozen,i create this extended version.
looking for more information with this issue text/tabwriter: character width #8273.
go get github.com/jormin/tabwriter
// Update the cell width.
func (b *Writer) updateWidth() {
b.cell.width += utf8.RuneCount(b.buf[b.pos:])
b.pos = len(b.buf)
}
// Update the cell width.
func (b *Writer) updateWidth() {
// b.cell.width += utf8.RuneCount(b.buf[b.pos:])
b.cell.width += runewidth.StringWidth(string(b.buf[b.pos:]))
b.pos = len(b.buf)
}
under the MIT License