func String(s string, width uint) string {
	return StringWithTail(s, width, "")
}
String is shorthand for declaring a new default truncate-writer instance,
used to immediately truncate a string.
package truncate
import (
	"bytes"
	"io"
	"github.com/mattn/go-runewidth"
	"github.com/muesli/reflow/ansi"
)
type Writer struct {
	width uint
	tail  string
	ansiWriter *ansi.Writer
	buf        bytes.Buffer
	ansi       bool
}
func NewWriter(width uint, tail string) *Writer {
	w := &Writer{
		width: width,
		tail:  tail,
	}
	w.ansiWriter = &ansi.Writer{
		Forward: &w.buf,
	}
	return w
}
func NewWriterPipe(forward io.Writer, width uint, tail string) *Writer {
	return &Writer{
		width: width,
		tail:  tail,
		ansiWriter: &ansi.Writer{
			Forward: forward,
		},
	}
}
func Bytes(b []byte, width uint) []byte {
	return BytesWithTail(b, width, []byte(""))
}
func BytesWithTail(b []byte, width uint, tail []byte) []byte {
	f := NewWriter(width, string(tail))
	_, _ = f.Write(b)
	return f.Bytes()
}