Add support for some ctrl keys

Ctrl-{Ins,Del,Home,End} now work in some terminals.
Tested with xterm and konsole. May not work fot VTE-based ones
(gnome and xfce).
This commit is contained in:
Alexandre Bury 2015-06-01 10:49:43 -07:00
parent f81a9b2768
commit 405cd1e961

View File

@ -35,13 +35,16 @@ pub enum Key {
PageDown,
Backspace,
Home,
CtrlHome,
End,
CtrlEnd,
/// Delete key
Del,
ShiftDel,
CtrlDel,
/// Insert key
Ins,
CtrlIns,
/// Escape key. Often buffered by the terminal,
/// may appear with a delay or along with the next key.
Esc,
@ -79,6 +82,9 @@ impl Key {
// Those keys don't seem to be documented...
515 => Key::CtrlDel,
521 => Key::CtrlDown,
526 => Key::CtrlEnd,
531 => Key::CtrlHome,
536 => Key::CtrlIns,
541 => Key::CtrlLeft,
542 => Key::CtrlShiftLeft,
546 => Key::CtrlPageDown,
@ -144,13 +150,16 @@ impl fmt::Display for Key {
Key::PageUp => "PageUp",
Key::PageDown => "PageDown",
Key::Home => "Home",
Key::CtrlHome => "Ctrl-Home",
Key::End => "End",
Key::CtrlEnd => "Ctrl-End",
Key::Backspace => "Backspace",
Key::Del => "Del",
Key::Enter => "Enter",
Key::ShiftTab => "Shift-Tab",
Key::Tab => "Tab",
Key::Ins => "Ins",
Key::CtrlIns => "Ctrl-Ins",
Key::Esc => "Esc",
_ => "Missing key label",
}),