Add Tab key to events

This commit is contained in:
Alexandre Bury 2015-05-27 22:21:23 -07:00
parent 3d1507c3cf
commit 0bdb86181b

View File

@ -23,6 +23,7 @@ pub enum EventResult {
#[derive(PartialEq,Eq,Clone,Copy,Hash)] #[derive(PartialEq,Eq,Clone,Copy,Hash)]
pub enum Key { pub enum Key {
Enter, Enter,
Tab,
ArrowLeft, ArrowLeft,
ArrowRight, ArrowRight,
ArrowUp, ArrowUp,
@ -39,6 +40,7 @@ pub enum Key {
impl Key { impl Key {
pub fn from_ncurses(ch: i32) -> Self { pub fn from_ncurses(ch: i32) -> Self {
match ch { match ch {
9 => Key::Tab,
10 => Key::Enter, 10 => Key::Enter,
127 => Key::Backspace, 127 => Key::Backspace,
330 => Key::Del, 330 => Key::Del,
@ -70,6 +72,8 @@ impl fmt::Display for Key {
Key::End => "End", Key::End => "End",
Key::Backspace => "Backspace", Key::Backspace => "Backspace",
Key::Del => "Del", Key::Del => "Del",
Key::Enter => "Enter",
Key::Tab => "Tab",
_ => "", _ => "",
}), }),
} }