package strutilimport// ConvertMeta recursively searches for metafied keys in a sequence,// and replaces them with an esc prefix and their unmeta equivalent.func ( []rune) string {iflen() == 0 {returnstring() } := 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()) }returnstring()}// 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 quotedif == inputrc.Tab { = append(, )return , len() }switch {caseinputrc.IsMeta(): = append(, '^', '[') = append(, inputrc.Demeta())caseinputrc.IsControl(): = append(, '^') = append(, inputrc.Decontrol())default: = []rune(inputrc.Unescape(string())) }return , len()}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.