code: func EscapedLen(s string) int {
  	if len(s) == 0 {
  		return 0
  	}
  
  	var rw, total int
  	for i := 0; i < len(s); i += rw {
  		v, width := utf8.DecodeRuneInString(s[i:])
  		if v == '\x1b' {
  			_, skip, err := DecodeColor(s[i:])
  			if err == nil {
  				rw = skip
  				total += skip
  				continue
  
  			}
  		}
  		rw = width
  	}
  
  	return total
  }
docs: // EscapedLen returns total length of all escape sequences in a given string.