pub enum KeyCode {
Show 27 variants
Char(char),
Enter,
Backspace,
Tab,
Escape,
Left,
Right,
Up,
Down,
Home,
End,
BackTab,
PageUp,
PageDown,
Insert,
Delete,
KeypadBegin,
CapsLock,
ScrollLock,
NumLock,
PrintScreen,
Pause,
Menu,
Null,
Function(u8),
Modifier(ModifierKeyCode),
Media(MediaKeyCode),
}Expand description
The key identity reported by the terminal.
Variants§
Char(char)
A Unicode character key after terminal decoding.
Termina stores the character it can identify from the input source rather than normalizing
every alphabetic key to lowercase plus Modifiers::SHIFT. For ordinary UTF-8 terminal
input, A is reported as Char('A') and Shift is also recorded in modifiers when Termina
can infer it from the decoded character. Control bytes such as Ctrl+A are reported as
Char('a') with Modifiers::CONTROL. Enhanced keyboard protocols and the Windows
backend may use layout-aware or protocol-supplied characters, so callers should compare
against the character they want to handle instead of assuming another terminal library’s
capitalization model.
Enter
The Enter or Return key.
Backspace
The Backspace key.
Tab
The Tab key.
Escape
The Escape key.
Left
The left arrow key.
Right
The right arrow key.
Up
The up arrow key.
Down
The down arrow key.
Home
The Home key.
End
The End key.
BackTab
Shift+Tab or another backwards-tab key sequence.
PageUp
The Page Up key.
PageDown
The Page Down key.
Insert
The Insert key.
Delete
The Delete key.
KeypadBegin
The keypad begin key.
CapsLock
The Caps Lock key.
ScrollLock
The Scroll Lock key.
NumLock
The Num Lock key.
PrintScreen
The Print Screen key.
Pause
The Pause or Break key.
Menu
The Menu or Application key.
Null
A null key code.
This can appear when a platform backend reports a key event without a printable or named key identity.
Function(u8)
F1-F35 function keys.
Modifier(ModifierKeyCode)
A modifier key such as Shift, Control, Alt, Super, Hyper, or Meta.
Media(MediaKeyCode)
A media control key.