Add some more input

This commit is contained in:
Alexandre Bury 2015-06-06 22:48:16 -07:00
parent 3a1e40ed49
commit 14a18ce760

View File

@ -47,16 +47,21 @@ pub enum Key {
ShiftDel, ShiftDel,
CtrlDel, CtrlDel,
CtrlShiftDel, CtrlShiftDel,
/// Insert key /// Insert key.
Ins, Ins,
/// Insert key while ctrl is pressed.
CtrlIns, CtrlIns,
/// Escape key. Often buffered by the terminal, /// Escape key.
/// may appear with a delay or along with the next key.
Esc, Esc,
// Left arrow while shift is pressed /// The 5 in the center of the keypad, when numlock is disabled.
NumpadCenter,
CtrlPageUp, CtrlPageUp,
CtrlPageDown, CtrlPageDown,
ShiftUp,
ShiftDown,
/// Left arrow while shift is pressed.
ShiftLeft, ShiftLeft,
/// Right arrow while shift is pressed.
ShiftRight, ShiftRight,
CtrlShiftLeft, CtrlShiftLeft,
CtrlShiftRight, CtrlShiftRight,
@ -105,6 +110,7 @@ impl Key {
557 => Key::CtrlShiftRight, 557 => Key::CtrlShiftRight,
562 => Key::CtrlUp, 562 => Key::CtrlUp,
563 => Key::CtrlShiftUp, 563 => Key::CtrlShiftUp,
ncurses::KEY_B2 => Key::NumpadCenter,
ncurses::KEY_DC => Key::Del, ncurses::KEY_DC => Key::Del,
ncurses::KEY_IC => Key::Ins, ncurses::KEY_IC => Key::Ins,
ncurses::KEY_BTAB => Key::ShiftTab, ncurses::KEY_BTAB => Key::ShiftTab,
@ -114,6 +120,8 @@ impl Key {
ncurses::KEY_RIGHT => Key::Right, ncurses::KEY_RIGHT => Key::Right,
ncurses::KEY_UP => Key::Up, ncurses::KEY_UP => Key::Up,
ncurses::KEY_DOWN => Key::Down, ncurses::KEY_DOWN => Key::Down,
ncurses::KEY_SR => Key::ShiftUp,
ncurses::KEY_SF => Key::ShiftDown,
ncurses::KEY_PPAGE => Key::PageUp, ncurses::KEY_PPAGE => Key::PageUp,
ncurses::KEY_NPAGE => Key::PageDown, ncurses::KEY_NPAGE => Key::PageDown,
ncurses::KEY_HOME => Key::Home, ncurses::KEY_HOME => Key::Home,
@ -146,6 +154,7 @@ impl fmt::Display for Key {
Key::CtrlF(n) => write!(f, "Ctrl-F{}", n), Key::CtrlF(n) => write!(f, "Ctrl-F{}", n),
Key::CtrlShiftF(n) => write!(f, "Ctrl-Shift-F{}", n), Key::CtrlShiftF(n) => write!(f, "Ctrl-Shift-F{}", n),
key => write!(f, "{}", match key { key => write!(f, "{}", match key {
Key::NumpadCenter => "Numpad center",
Key::Left => "Left", Key::Left => "Left",
Key::Right => "Right", Key::Right => "Right",
Key::Down => "Down", Key::Down => "Down",
@ -154,6 +163,8 @@ impl fmt::Display for Key {
Key::CtrlShiftRight => "Ctrl-Shift-Right", Key::CtrlShiftRight => "Ctrl-Shift-Right",
Key::CtrlShiftUp => "Ctrl-Shift-Up", Key::CtrlShiftUp => "Ctrl-Shift-Up",
Key::CtrlShiftDown => "Ctrl-Shift-Down", Key::CtrlShiftDown => "Ctrl-Shift-Down",
Key::ShiftUp => "Shift-Up",
Key::ShiftDown => "Shift-Down",
Key::ShiftLeft => "Shift-Left", Key::ShiftLeft => "Shift-Left",
Key::ShiftRight => "Shift-Right", Key::ShiftRight => "Shift-Right",
Key::ShiftDel => "Shift-Del", Key::ShiftDel => "Shift-Del",