1// +build !windows
2
3package termbox
4
5// Eterm
6var eterm_keys = []string{
7	"\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
8}
9var eterm_funcs = []string{
10	t_enter_ca:     "\x1b7\x1b[?47h",
11	t_exit_ca:      "\x1b[2J\x1b[?47l\x1b8",
12	t_show_cursor:  "\x1b[?25h",
13	t_hide_cursor:  "\x1b[?25l",
14	t_clear_screen: "\x1b[H\x1b[2J",
15	t_sgr0:         "\x1b[m\x0f",
16	t_underline:    "\x1b[4m",
17	t_bold:         "\x1b[1m",
18	t_hidden:       "",
19	t_blink:        "\x1b[5m",
20	t_dim:          "",
21	t_cursive:      "",
22	t_reverse:      "\x1b[7m",
23	t_enter_keypad: "",
24	t_exit_keypad:  "",
25	t_enter_mouse:  "",
26	t_exit_mouse:   "",
27}
28
29// screen
30var screen_keys = []string{
31	"\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC",
32}
33var screen_funcs = []string{
34	t_enter_ca:     "\x1b[?1049h",
35	t_exit_ca:      "\x1b[?1049l",
36	t_show_cursor:  "\x1b[34h\x1b[?25h",
37	t_hide_cursor:  "\x1b[?25l",
38	t_clear_screen: "\x1b[H\x1b[J",
39	t_sgr0:         "\x1b[m\x0f",
40	t_underline:    "\x1b[4m",
41	t_bold:         "\x1b[1m",
42	t_hidden:       "",
43	t_blink:        "\x1b[5m",
44	t_dim:          "",
45	t_cursive:      "",
46	t_reverse:      "\x1b[7m",
47	t_enter_keypad: "\x1b[?1h\x1b=",
48	t_exit_keypad:  "\x1b[?1l\x1b>",
49	t_enter_mouse:  ti_mouse_enter,
50	t_exit_mouse:   ti_mouse_leave,
51}
52
53// xterm
54var xterm_keys = []string{
55	"\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1bOH", "\x1bOF", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC",
56}
57var xterm_funcs = []string{
58	t_enter_ca:     "\x1b[?1049h",
59	t_exit_ca:      "\x1b[?1049l",
60	t_show_cursor:  "\x1b[?12l\x1b[?25h",
61	t_hide_cursor:  "\x1b[?25l",
62	t_clear_screen: "\x1b[H\x1b[2J",
63	t_sgr0:         "\x1b(B\x1b[m",
64	t_underline:    "\x1b[4m",
65	t_bold:         "\x1b[1m",
66	t_hidden:       "",
67	t_blink:        "\x1b[5m",
68	t_dim:          "",
69	t_cursive:      "",
70	t_reverse:      "\x1b[7m",
71	t_enter_keypad: "\x1b[?1h\x1b=",
72	t_exit_keypad:  "\x1b[?1l\x1b>",
73	t_enter_mouse:  ti_mouse_enter,
74	t_exit_mouse:   ti_mouse_leave,
75}
76
77// rxvt-unicode
78var rxvt_unicode_keys = []string{
79	"\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
80}
81var rxvt_unicode_funcs = []string{
82	t_enter_ca:     "\x1b[?1049h",
83	t_exit_ca:      "\x1b[r\x1b[?1049l",
84	t_show_cursor:  "\x1b[?25h",
85	t_hide_cursor:  "\x1b[?25l",
86	t_clear_screen: "\x1b[H\x1b[2J",
87	t_sgr0:         "\x1b[m\x1b(B",
88	t_underline:    "\x1b[4m",
89	t_bold:         "\x1b[1m",
90	t_hidden:       "",
91	t_blink:        "\x1b[5m",
92	t_dim:          "",
93	t_cursive:      "",
94	t_reverse:      "\x1b[7m",
95	t_enter_keypad: "\x1b=",
96	t_exit_keypad:  "\x1b>",
97	t_enter_mouse:  ti_mouse_enter,
98	t_exit_mouse:   ti_mouse_leave,
99}
100
101// linux
102var linux_keys = []string{
103	"\x1b[[A", "\x1b[[B", "\x1b[[C", "\x1b[[D", "\x1b[[E", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
104}
105var linux_funcs = []string{
106	t_enter_ca:     "",
107	t_exit_ca:      "",
108	t_show_cursor:  "\x1b[?25h\x1b[?0c",
109	t_hide_cursor:  "\x1b[?25l\x1b[?1c",
110	t_clear_screen: "\x1b[H\x1b[J",
111	t_sgr0:         "\x1b[0;10m",
112	t_underline:    "\x1b[4m",
113	t_bold:         "\x1b[1m",
114	t_hidden:       "",
115	t_blink:        "\x1b[5m",
116	t_dim:          "",
117	t_cursive:      "",
118	t_reverse:      "\x1b[7m",
119	t_enter_keypad: "",
120	t_exit_keypad:  "",
121	t_enter_mouse:  "",
122	t_exit_mouse:   "",
123}
124
125// rxvt-256color
126var rxvt_256color_keys = []string{
127	"\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
128}
129var rxvt_256color_funcs = []string{
130	t_enter_ca:     "\x1b7\x1b[?47h",
131	t_exit_ca:      "\x1b[2J\x1b[?47l\x1b8",
132	t_show_cursor:  "\x1b[?25h",
133	t_hide_cursor:  "\x1b[?25l",
134	t_clear_screen: "\x1b[H\x1b[2J",
135	t_sgr0:         "\x1b[m\x0f",
136	t_underline:    "\x1b[4m",
137	t_bold:         "\x1b[1m",
138	t_hidden:       "",
139	t_blink:        "\x1b[5m",
140	t_dim:          "",
141	t_cursive:      "",
142	t_reverse:      "\x1b[7m",
143	t_enter_keypad: "\x1b=",
144	t_exit_keypad:  "\x1b>",
145	t_enter_mouse:  ti_mouse_enter,
146	t_exit_mouse:   ti_mouse_leave,
147}
148
149var terms = []struct {
150	name  string
151	keys  []string
152	funcs []string
153}{
154	{"Eterm", eterm_keys, eterm_funcs},
155	{"screen", screen_keys, screen_funcs},
156	{"xterm", xterm_keys, xterm_funcs},
157	{"rxvt-unicode", rxvt_unicode_keys, rxvt_unicode_funcs},
158	{"linux", linux_keys, linux_funcs},
159	{"rxvt-256color", rxvt_256color_keys, rxvt_256color_funcs},
160}
161