Okay, CTRL+C
is 0x03
in raw mode. And if you follow the formula (c as u8 - 0x1 + b'a') as char),
, 0x03
is indeed the ASCII code for c
, which is 0x63
(0x03 - 0x01 + 0x61)
.
First row is for ASCII letters a-z
.
Second row (just a guess):
0x1c - 0x1c + 0b'4'
== 0x1c - 0x1c + 0x34'
=> ... CTRL+4 .. CTRL+7?! I don't understand the second row.
This should be documented with background info inside the code.
Hi. In https://gitlab.redox-os.org/redox-os/termion/-/blob/master/src/event.rs#L131 you have lots of important yet hard to understand parsing code for input keys. Especially the "CTRL-"-sequences are hard to understand. Can you maybe add a comment where/in what specification these values can be found for educational reasons? Please be more specific than "ANSI escape sequences".
c @ b'\x01'..=b'\x1A' => Ok(Event::Key(Key::Ctrl((c as u8 - 0x1 + b'a') as char))),
c @ b'\x1C'..=b'\x1F' => Ok(Event::Key(Key::Ctrl((c as u8 - 0x1C + b'4') as char))),
CTRL-
-key-combinations/shortcuts?c
b'a'
/b'4'
?