func strlen()

in pkg/text/colortabwriter.go [106:126]


func strlen(cell []byte) int {
	nChars := 0
	inEscape := false
	for _, c := range cell {
		switch c {
		case 0x1b:
			inEscape = true
		case 'm':
			if inEscape {
				inEscape = false
			} else {
				nChars++
			}
		default:
			if !inEscape {
				nChars++
			}
		}
	}
	return nChars
}