Merge pull request #417 from Demonthos/master

handle backtab for tui
This commit is contained in:
Jon Kelley 2022-06-13 11:13:00 -04:00 committed by GitHub
commit d9e14db434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -664,6 +664,7 @@ fn get_event(evt: TermEvent) -> Option<(&'static str, EventData)> {
fn translate_key_event(event: crossterm::event::KeyEvent) -> Option<EventData> {
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<EventData> {
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<EventData> {
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(),