func (rr *RuneReader) ReadRune() (rune, int, error) {
	r, size, err := state.reader.ReadRune()
	if err != nil {
		return r, size, err
	}
	if r == '\033' {
		if state.reader.Buffered() == 0 {
			return rune(KeyESC), 1, nil
		}
		r, size, err = state.reader.ReadRune()
		if err != nil {
			return r, size, err
		}
		if r != '[' {
			return r, size, fmt.Errorf("Unexpected Escape Sequence: %q", []rune{'\033', r})
		}
		r, size, err = state.reader.ReadRune()
		if err != nil {
			return r, size, err
		}
		switch r {
		case 'D':
			return ArrowLeft, 1, nil
		case 'C':
			return ArrowRight, 1, nil
		case 'A':
			return ArrowUp, 1, nil
		case 'B':
			return ArrowDown, 1, nil
		case 'H':  
			return rune(KeyCtrlA), 1, nil
		case 'F':  
			return rune(KeyCtrlQ), 1, nil
		case '3':  
			state.reader.Discard(1)
			return rune(KeyCtrlR), 1, nil
		default:
			state.reader.Discard(1)
			return rune(KeyCtrlSpace), 1, nil
		}
	}
	return r, size, err
}
ReadRune returns a single rune from the stdin
package term
import (
	"fmt"
)
type RuneReader struct {
	in Reader
}
func NewRuneReader(reader Reader) *RuneReader {
	return &RuneReader{
		in: reader,
	}
}