Fix ctrl characters

This commit is contained in:
Jeremy Soller 2023-12-18 13:57:38 -07:00
parent 65b613e6e4
commit 2b0548de46
No known key found for this signature in database
GPG key ID: DCFCA852D3906975

View file

@ -203,19 +203,13 @@ fn main() {
} if window_id == window.id() => {
match (modifiers.logo(), modifiers.ctrl(), modifiers.alt()) {
(true, _, _) => {} // Ignore super
(false, true, _) => {
// Control keys
if c >= 'a' && c <= 'z' {
notifier.notify(vec![(c as u8) - b'a' + 1]);
}
}
(false, false, true) => {
(false, _, true) => {
// Alt keys
let mut buf = [0x1B, 0, 0, 0, 0];
let str = c.encode_utf8(&mut buf[1..]);
notifier.notify(str.as_bytes().to_vec());
}
(false, false, false) => {
(false, _, false) => {
let mut buf = [0, 0, 0, 0];
let str = c.encode_utf8(&mut buf);
notifier.notify(str.as_bytes().to_vec());