func trimStr2Runes(s string, w int) []rune { if w <= 0 { return []rune{} } sw := rw.StringWidth(s) if sw > w { return []rune(rw.Truncate(s, w, dot)) } return str2runes(s) //[]rune(rw.Truncate(s, w, "")) }
func strWidth(s string) int { return rw.StringWidth(s) }
ColorBlue ColorMagenta ColorCyan ColorWhite ) const NumberofColors = 8 //Have a constant that defines number of colors const ( AttrBold Attribute = 1 << (iota + 9) AttrUnderline AttrReverse ) var ( dot = "…" dotw = rw.StringWidth(dot) ) /* ----------------------- End ----------------------------- */ func toTmAttr(x Attribute) tm.Attribute { return tm.Attribute(x) } func str2runes(s string) []rune { return []rune(s) } func trimStr2Runes(s string, w int) []rune { if w <= 0 { return []rune{}