pub fn new(c: char, mut mods: Modifiers) -> Self {
        use {KeyCode as K, KeyEvent as E, Modifiers as M};

        if !c.is_control() {
            if !mods.is_empty() {
                mods.remove(M::SHIFT); // TODO Validate: no SHIFT even if
                                       // `c` is uppercase
            }
            return E(K::Char(c), mods);
        }
        #[allow(clippy::match_same_arms)]
        match c {
            '\x00' => E(K::Char('@'), mods | M::CTRL), // '\0'
            '\x01' => E(K::Char('A'), mods | M::CTRL),
            '\x02' => E(K::Char('B'), mods | M::CTRL),
            '\x03' => E(K::Char('C'), mods | M::CTRL),
            '\x04' => E(K::Char('D'), mods | M::CTRL),
            '\x05' => E(K::Char('E'), mods | M::CTRL),
            '\x06' => E(K::Char('F'), mods | M::CTRL),
            '\x07' => E(K::Char('G'), mods | M::CTRL), // '\a'
            #[cfg(unix)]
            '\x08' => E(K::Backspace, mods), // '\b'
            #[cfg(windows)]
            '\x08' => E(K::Char('H'), mods | M::CTRL),
            #[cfg(unix)]
            '\x09' => {
                // '\t'
                if mods.contains(M::SHIFT) {
                    mods.remove(M::SHIFT);
                    E(K::BackTab, mods)
                } else {
                    E(K::Tab, mods)
                }
            }
            #[cfg(windows)]
            '\x09' => E(K::Char('I'), mods | M::CTRL),
            '\x0a' => E(K::Char('J'), mods | M::CTRL), // '\n' (10)
            '\x0b' => E(K::Char('K'), mods | M::CTRL),
            '\x0c' => E(K::Char('L'), mods | M::CTRL),
            #[cfg(unix)]
            '\x0d' => E(K::Enter, mods), // '\r' (13)
            #[cfg(windows)]
            '\x0d' => E(K::Char('M'), mods | M::CTRL),
            '\x0e' => E(K::Char('N'), mods | M::CTRL),
            '\x0f' => E(K::Char('O'), mods | M::CTRL),
            '\x10' => E(K::Char('P'), mods | M::CTRL),
            '\x11' => E(K::Char('Q'), mods | M::CTRL),
            '\x12' => E(K::Char('R'), mods | M::CTRL),
            '\x13' => E(K::Char('S'), mods | M::CTRL),
            '\x14' => E(K::Char('T'), mods | M::CTRL),
            '\x15' => E(K::Char('U'), mods | M::CTRL),
            '\x16' => E(K::Char('V'), mods | M::CTRL),
            '\x17' => E(K::Char('W'), mods | M::CTRL),
            '\x18' => E(K::Char('X'), mods | M::CTRL),
            '\x19' => E(K::Char('Y'), mods | M::CTRL),
            '\x1a' => E(K::Char('Z'), mods | M::CTRL),
            '\x1b' => E(K::Esc, mods), // Ctrl-[, '\e'
            '\x1c' => E(K::Char('\\'), mods | M::CTRL),
            '\x1d' => E(K::Char(']'), mods | M::CTRL),
            '\x1e' => E(K::Char('^'), mods | M::CTRL),
            '\x1f' => E(K::Char('_'), mods | M::CTRL),
            '\x7f' => E(K::Backspace, mods), // Rubout, Ctrl-?
            '\u{9b}' => E(K::Esc, mods | M::SHIFT),
            _ => E(K::Null, mods),
        }
    }
/// Constructor from `char` and modifiers
Constructor from `char` and modifiers
Constructor from ` char ` and modifiers
pub fn new(c: char, mut mods: Modifiers) -> Self {
        use {KeyCode as K, KeyEvent as E, Modifiers as M};
        if !c.is_control() {
            if !mods.is_empty() {
                mods.remove(M::SHIFT); // TODO Validate: no SHIFT even if
                                       // `c` is uppercase
            }
            return E(K::Char(c), mods);
        }
        #[allow(clippy::match_same_arms)]
        match c {
            '\x00' => E(K::Char('@'), mods | M::CTRL), // '\0'
            '\x01' => E(K::Char('A'), mods | M::CTRL),
            '\x02' => E(K::Char('B'), mods | M::CTRL),
            '\x03' => E(K::Char('C'), mods | M::CTRL),
            '\x04' => E(K::Char('D'), mods | M::CTRL),
            '\x05' => E(K::Char('E'), mods | M::CTRL),
            '\x06' => E(K::Char('F'), mods | M::CTRL),
            '\x07' => E(K::Char('G'), mods | M::CTRL), // '\a'
            #[cfg(unix)]
            '\x08' => E(K::Backspace, mods), // '\b'
            #[cfg(windows)]
            '\x08' => E(K::Char('H'), mods | M::CTRL),
            #[cfg(unix)]
            '\x09' => {
                // '\t'
                if mods.contains(M::SHIFT) {
                    mods.remove(M::SHIFT);
                    E(K::BackTab, mods)
                } else {
                    E(K::Tab, mods)
                }
            }
            #[cfg(windows)]
            '\x09' => E(K::Char('I'), mods | M::CTRL),
            '\x0a' => E(K::Char('J'), mods | M::CTRL), // '\n' (10)
            '\x0b' => E(K::Char('K'), mods | M::CTRL),
            '\x0c' => E(K::Char('L'), mods | M::CTRL),
            #[cfg(unix)]
            '\x0d' => E(K::Enter, mods), // '\r' (13)
            #[cfg(windows)]
            '\x0d' => E(K::Char('M'), mods | M::CTRL),
            '\x0e' => E(K::Char('N'), mods | M::CTRL),
            '\x0f' => E(K::Char('O'), mods | M::CTRL),
            '\x10' => E(K::Char('P'), mods | M::CTRL),
            '\x11' => E(K::Char('Q'), mods | M::CTRL),
            '\x12' => E(K::Char('R'), mods | M::CTRL),
            '\x13' => E(K::Char('S'), mods | M::CTRL),
            '\x14' => E(K::Char('T'), mods | M::CTRL),
            '\x15' => E(K::Char('U'), mods | M::CTRL),
            '\x16' => E(K::Char('V'), mods | M::CTRL),
            '\x17' => E(K::Char('W'), mods | M::CTRL),
            '\x18' => E(K::Char('X'), mods | M::CTRL),
            '\x19' => E(K::Char('Y'), mods | M::CTRL),
            '\x1a' => E(K::Char('Z'), mods | M::CTRL),
            '\x1b' => E(K::Esc, mods), // Ctrl-[, '\e'
            '\x1c' => E(K::Char('\\'), mods | M::CTRL),
            '\x1d' => E(K::Char(']'), mods | M::CTRL),
            '\x1e' => E(K::Char('^'), mods | M::CTRL),
            '\x1f' => E(K::Char('_'), mods | M::CTRL),
            '\x7f' => E(K::Backspace, mods), // Rubout, Ctrl-?
            '\u{9b}' => E(K::Esc, mods | M::SHIFT),
            _ => E(K::Null, mods),
        }
    }
pub fn new ( c : char , mut mods : Modifiers ) -> Self { use { KeyCode as K , KeyEvent as E , Modifiers as M } ; if ! c . is_control ( ) { if ! mods . is_empty ( ) { mods . remove ( M :: SHIFT ) ; // TODO Validate: no SHIFT even if // `c` is uppercase } return E ( K :: Char ( c ) , mods ) ; } # [ allow ( clippy match_same_arms ) ] match c { '\x00' => E ( K :: Char ( '@' ) , mods | M :: CTRL ) , // '\0' '\x01' => E ( K :: Char ( 'A' ) , mods | M :: CTRL ) , '\x02' => E ( K :: Char ( 'B' ) , mods | M :: CTRL ) , '\x03' => E ( K :: Char ( 'C' ) , mods | M :: CTRL ) , '\x04' => E ( K :: Char ( 'D' ) , mods | M :: CTRL ) , '\x05' => E ( K :: Char ( 'E' ) , mods | M :: CTRL ) , '\x06' => E ( K :: Char ( 'F' ) , mods | M :: CTRL ) , '\x07' => E ( K :: Char ( 'G' ) , mods | M :: CTRL ) , // '\a' # [ cfg ( unix ) ] '\x08' => E ( K :: Backspace , mods ) , // '\b' # [ cfg ( windows ) ] '\x08' => E ( K :: Char ( 'H' ) , mods | M :: CTRL ) , # [ cfg ( unix ) ] '\x09' => { // '\t' if mods . contains ( M :: SHIFT ) { mods . remove ( M :: SHIFT ) ; E ( K :: BackTab , mods ) } else { E ( K :: Tab , mods ) } } # [ cfg ( windows ) ] '\x09' => E ( K :: Char ( 'I' ) , mods | M :: CTRL ) , '\x0a' => E ( K :: Char ( 'J' ) , mods | M :: CTRL ) , // '\n' (10) '\x0b' => E ( K :: Char ( 'K' ) , mods | M :: CTRL ) , '\x0c' => E ( K :: Char ( 'L' ) , mods | M :: CTRL ) , # [ cfg ( unix ) ] '\x0d' => E ( K :: Enter , mods ) , // '\r' (13) # [ cfg ( windows ) ] '\x0d' => E ( K :: Char ( 'M' ) , mods | M :: CTRL ) , '\x0e' => E ( K :: Char ( 'N' ) , mods | M :: CTRL ) , '\x0f' => E ( K :: Char ( 'O' ) , mods | M :: CTRL ) , '\x10' => E ( K :: Char ( 'P' ) , mods | M :: CTRL ) , '\x11' => E ( K :: Char ( 'Q' ) , mods | M :: CTRL ) , '\x12' => E ( K :: Char ( 'R' ) , mods | M :: CTRL ) , '\x13' => E ( K :: Char ( 'S' ) , mods | M :: CTRL ) , '\x14' => E ( K :: Char ( 'T' ) , mods | M :: CTRL ) , '\x15' => E ( K :: Char ( 'U' ) , mods | M :: CTRL ) , '\x16' => E ( K :: Char ( 'V' ) , mods | M :: CTRL ) , '\x17' => E ( K :: Char ( 'W' ) , mods | M :: CTRL ) , '\x18' => E ( K :: Char ( 'X' ) , mods | M :: CTRL ) , '\x19' => E ( K :: Char ( 'Y' ) , mods | M :: CTRL ) , '\x1a' => E ( K :: Char ( 'Z' ) , mods | M :: CTRL ) , '\x1b' => E ( K :: Esc , mods ) , // Ctrl-[, '\e' '\x1c' => E ( K :: Char ( '\\' ) , mods | M :: CTRL ) , '\x1d' => E ( K :: Char ( ']' ) , mods | M :: CTRL ) , '\x1e' => E ( K :: Char ( '^' ) , mods | M :: CTRL ) , '\x1f' => E ( K :: Char ( '_' ) , mods | M :: CTRL ) , '\x7f' => E ( K :: Backspace , mods ) , // Rubout, Ctrl-? '\u{9b}' => E ( K :: Esc , mods | M :: SHIFT ) , _ => E ( K :: Null , mods ) , } }
Constructor from `char` and modifiers
Constructor from ` char ` and modifiers
c
char
mods
Modifiers
c
char
mods
Modifiers