Skip to content

Commit

Permalink
Merge pull request #417 from Demonthos/master
Browse files Browse the repository at this point in the history
handle backtab for tui
  • Loading branch information
jkelleyrtp authored Jun 13, 2022
2 parents 24273e4 + 6ab79a1 commit d9e14db
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/tui/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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,
};
Expand All @@ -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(),
Expand Down

0 comments on commit d9e14db

Please sign in to comment.