From d6eaf8778fd3115b0a5e933960d17c519515f9ca Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Sat, 21 May 2022 18:08:52 -0500 Subject: [PATCH] handle backtab --- packages/tui/src/hooks.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/tui/src/hooks.rs b/packages/tui/src/hooks.rs index 5481d6b1c3..13cef2c41c 100644 --- a/packages/tui/src/hooks.rs +++ b/packages/tui/src/hooks.rs @@ -664,6 +664,7 @@ fn get_event(evt: TermEvent) -> Option<(&'static str, EventData)> { fn translate_key_event(event: crossterm::event::KeyEvent) -> Option { let (code, key_str); + let mut shift_key = event.modifiers.contains(KeyModifiers::SHIFT); if let TermKeyCode::Char(c) = event.code { code = match c { 'A'..='Z' | 'a'..='z' => match c.to_ascii_uppercase() { @@ -777,7 +778,11 @@ fn translate_key_event(event: crossterm::event::KeyEvent) -> Option { 12 => KeyCode::F12, _ => return None, }, - TermKeyCode::BackTab => return None, + // backtab is Shift + Tab + TermKeyCode::BackTab => { + shift_key = true; + KeyCode::Tab + } TermKeyCode::Null => return None, _ => return None, }; @@ -795,7 +800,7 @@ fn translate_key_event(event: crossterm::event::KeyEvent) -> Option { alt_key: event.modifiers.contains(KeyModifiers::ALT), ctrl_key: event.modifiers.contains(KeyModifiers::CONTROL), meta_key: false, - shift_key: event.modifiers.contains(KeyModifiers::SHIFT), + shift_key, locale: Default::default(), location: 0x00, repeat: Default::default(),