1 module keyboard;
2 
3 // Key constants. See also struct Event's key field.
4 enum Key : ushort {
5     /* These are a safe subset of terminfo keys, which exist on all popular
6      * terminals. Termbox uses only them to stay truly portable.
7      */
8     f1             = 0xffff-0,
9     f2             = 0xffff-1,
10     f3             = 0xffff-2,
11     f4             = 0xffff-3,
12     f5             = 0xffff-4,
13     f6             = 0xffff-5,
14     f7             = 0xffff-6,
15     f8             = 0xffff-7,
16     f9             = 0xffff-8,
17     f10            = 0xffff-9,
18     f11            = 0xffff-10,
19     f12            = 0xffff-11,
20     insert         = 0xffff-12,
21     del            = 0xffff-13,
22     home           = 0xffff-14,
23     end            = 0xffff-15,
24     pgup           = 0xffff-16,
25     pgdn           = 0xffff-17,
26     arrowUp        = 0xffff-18,
27     arrowDown      = 0xffff-19,
28     arrowLeft      = 0xffff-20,
29     arrowRight     = 0xffff-21,
30     mouseLeft      = 0xffff-22,
31     mouseRight     = 0xffff-23,
32     mouseMiddle    = 0xffff-24,
33     mouseRelease   = 0xffff-25,
34     mouseWheelUp   = 0xffff-26,
35     mouseWheelDown = 0xffff-27,
36 
37     /* These are all ASCII code points below SPACE character and a BACKSPACE key. */
38     ctrlTilde      = 0x00,
39     ctrl2          = 0x00, /* clash with 'ctrl_tilde' */
40     ctrlA          = 0x01,
41     ctrlB          = 0x02,
42     ctrlC          = 0x03,
43     ctrlD          = 0x04,
44     ctrlE          = 0x05,
45     ctrlF          = 0x06,
46     ctrlG          = 0x07,
47     backspace      = 0x08,
48     ctrlH          = 0x08, /* clash with 'ctrl_backspace' */
49     tab            = 0x09,
50     ctrlI          = 0x09, /* clash with 'tab' */
51     ctrlJ          = 0x0a,
52     ctrlK          = 0x0b,
53     ctrlL          = 0x0c,
54     enter          = 0x0d,
55     ctrlM          = 0x0d, /* clash with 'enter' */
56     ctrlN          = 0x0e,
57     ctrlO          = 0x0f,
58     ctrlP          = 0x10,
59     ctrlQ          = 0x11,
60     ctrlR          = 0x12,
61     ctrlS          = 0x13,
62     ctrlT          = 0x14,
63     ctrlU          = 0x15,
64     ctrlV          = 0x16,
65     ctrlW          = 0x17,
66     ctrlX          = 0x18,
67     ctrlY          = 0x19,
68     ctrlZ          = 0x1a,
69     esc            = 0x1b,
70     ctrlLsqBracket = 0x1b, /* clash with 'esc' */
71     ctrl3          = 0x1b, /* clash with 'esc' */
72     ctrl4          = 0x1c,
73     ctrlBackslash  = 0x1c, /* clash with 'ctrl_4' */
74     ctrl5          = 0x1d,
75     ctrlRsqBracket = 0x1d, /* clash with 'ctrl_5' */
76     ctrl6          = 0x1e,
77     ctrl7          = 0x1f,
78     ctrlSlash      = 0x1f, /* clash with 'ctrl_7' */
79     ctrlUnderscore = 0x1f, /* clash with 'ctrl_7' */
80     space          = 0x20,
81     backspace2     = 0x7f,
82     ctrl8          = 0x7f /* clash with 'backspace2' */
83 }
84 
85 /* Currently there is only one modifier. See also struct Event's mod
86  * field.
87  */
88 enum Mod : ubyte {
89     alt = 0x01
90 }