Module keys
Expand description
One spelling for a key: the token a shortcut declares (Ctrl+Enter), the
token a live press answers to (enter), and the key a test drives
(Enter).
A shortcut is written by a person and matched against a press, which winit
reports as a named key or a character. Both sides read their key through
canonical, so Esc, escape and the Escape key are one press, and so
are Space and the space bar.
Functions§
- canonical
keyas one token: itstokenwhen it is a live key, else the name a shortcut writes, in the same spelling.EscandEscape,Spaceand" ",UpandArrowUp,Eandeare each one token.- parse
- The key
specnames, as a driver or a typed shortcut writes it:Enter,Tab,Escape, the arrows,F1–F12,Home,End,PageUp,PageDown,Delete,Spaceand the rest; one character is that character typed (" "is the space bar’s character,"Space"the key). - token
- The token
keyanswers to, orNonefor a key no shortcut can name (a modifier pressed on its own, a media key).