diff --git a/crossterm_input/src/input/input.rs b/crossterm_input/src/input/input.rs index 3166a78..9731f1e 100644 --- a/crossterm_input/src/input/input.rs +++ b/crossterm_input/src/input/input.rs @@ -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 diff --git a/crossterm_input/src/input/mod.rs b/crossterm_input/src/input/mod.rs index 0f01e60..0cfd570 100644 --- a/crossterm_input/src/input/mod.rs +++ b/crossterm_input/src/input/mod.rs @@ -102,6 +102,7 @@ pub enum KeyEvent { End, PageUp, PageDown, + BackTab, Delete, Insert, F(u8), diff --git a/crossterm_input/src/input/windows_input.rs b/crossterm_input/src/input/windows_input.rs index ceebdf3..06c028d 100644 --- a/crossterm_input/src/input/windows_input.rs +++ b/crossterm_input/src/input/windows_input.rs @@ -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) { 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