Improve windows event parsing (#619)
This commit is contained in:
parent
aa4959f8f5
commit
32028c43e9
@ -91,10 +91,14 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option<KeyEvent> {
|
|||||||
&& !modifiers.contains(KeyModifiers::ALT)
|
&& !modifiers.contains(KeyModifiers::ALT)
|
||||||
{
|
{
|
||||||
// we need to do some parsing
|
// we need to do some parsing
|
||||||
character = match character_raw as u8 {
|
// Control character will take the ASCII code produced by the key and bitwise AND
|
||||||
c @ b'\x01'..=b'\x1A' => (c as u8 - 0x1 + b'a') as char,
|
// it with 31, forcing bits 6 and bits 7 to zero.
|
||||||
c @ b'\x1C'..=b'\x1F' => (c as u8 - 0x1C + b'4') as char,
|
// So we can make a bitwise OR back to see what's the raw control character.
|
||||||
_ => return None,
|
let c = character_raw as u8;
|
||||||
|
if c <= b'\x1F' {
|
||||||
|
character = (c | b'\x40') as char;
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user