package strutil

import 

// ConvertMeta recursively searches for metafied keys in a sequence,
// and replaces them with an esc prefix and their unmeta equivalent.
func ( []rune) string {
	if len() == 0 {
		return string()
	}

	 := make([]rune, 0)

	for  := 0;  < len(); ++ {
		 := []

		if !inputrc.IsMeta() {
			 = append(, )
			continue
		}

		// Replace the key with esc prefix and add the demetafied key.
		 = append(, inputrc.Esc)
		 = append(, inputrc.Demeta())
	}

	return string()
}

// Quote translates one rune in its printable version,
// which might be different for Control/Meta characters.
// Returns the "translated" string and new length. (eg 0x04 => ^C = len:2).
func ( rune) ( []rune,  int) {
	var  []rune

	// Special cases for keys that should not be quoted
	if  == inputrc.Tab {
		 = append(, )
		return , len()
	}

	switch {
	case inputrc.IsMeta():
		 = append(, '^', '[')
		 = append(, inputrc.Demeta())
	case inputrc.IsControl():
		 = append(, '^')
		 = append(, inputrc.Decontrol())
	default:
		 = []rune(inputrc.Unescape(string()))
	}

	return , len()
}