Backtab support (#129)

This commit is contained in:
scauligi 2019-04-29 11:17:44 -07:00 committed by Timon
parent b8be1910b6
commit e436e2eb39
3 changed files with 13 additions and 1 deletions

View File

@ -225,6 +225,7 @@ where
Some(b'B') => InputEvent::Keyboard(KeyEvent::Down),
Some(b'H') => InputEvent::Keyboard(KeyEvent::Home),
Some(b'F') => InputEvent::Keyboard(KeyEvent::End),
Some(b'Z') => InputEvent::Keyboard(KeyEvent::BackTab),
Some(b'M') => {
// X10 emulation mouse encoding: ESC [ CB Cx Cy (6 characters only).
// NOTE (@imdaveho): cannot find documentation on this

View File

@ -102,6 +102,7 @@ pub enum KeyEvent {
End,
PageUp,
PageDown,
BackTab,
Delete,
Insert,
F(u8),

View File

@ -15,7 +15,7 @@ use winapi::um::{
winuser::{
VK_BACK, VK_CONTROL, VK_DELETE, VK_DOWN, VK_END, VK_ESCAPE, VK_F1, VK_F10, VK_F11, VK_F12,
VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_HOME, VK_INSERT, VK_LEFT,
VK_MENU, VK_NEXT, VK_PRIOR, VK_RETURN, VK_RIGHT, VK_SHIFT, VK_UP,
VK_MENU, VK_NEXT, VK_PRIOR, VK_RETURN, VK_RIGHT, VK_SHIFT, VK_TAB, VK_UP,
},
};
@ -249,6 +249,16 @@ fn handle_key_event(key_event: &KeyEventRecord, seq: &mut Vec<u8>) {
seq.push(b'2');
seq.push(b'~');
}
VK_TAB => {
let key_state = &key_event.control_key_state;
if key_state.has_state(SHIFT_PRESSED) {
seq.push(b'\x1B');
seq.push(b'[');
seq.push(b'Z');
} else {
seq.push(b'\t');
}
}
_ => {
// Modifier Keys (Ctrl, Alt, Shift) Support
// NOTE (@imdaveho): test to check if characters outside of