xref: /haiku/src/apps/terminal/VTkeymap.h (revision c237c4ce593ee823d9867fd997e51e4c447f5623)
1 /*
2  * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
3  * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files or portions
7  * thereof (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so, subject
11  * to the following conditions:
12  *
13  *  * Redistributions of source code must retain the above copyright notice,
14  *    this list of conditions and the following disclaimer.
15  *
16  *  * Redistributions in binary form must reproduce the above copyright notice
17  *    in the  binary, as well as this list of conditions and the following
18  *    disclaimer in the documentation and/or other materials provided with
19  *    the distribution.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27  * THE SOFTWARE.
28  *
29  */
30 
31 #define CASE_IGNORE 0
32 #define CASE_FUNCTION 1
33 #define CASE_UP_ARROW 2
34 #define CASE_DOWN_ARROW 3
35 #define CASE_RIGHT_ARROW 4
36 #define CASE_LEFT_ARROW 5
37 #define CASE_RET_ENTR 6
38 
39 #define F1_KEY 0x02
40 #define F2_KEY 0x03
41 #define F3_KEY 0x04
42 #define F4_KEY 0x05
43 #define F5_KEY 0x06
44 #define F6_KEY 0x07
45 #define F7_KEY 0x08
46 #define F8_KEY 0x09
47 #define F9_KEY 0x0a
48 #define F10_KEY 0x0b
49 #define F11_KEY 0x0c
50 #define F12_KEY 0x0d
51 
52 #define RETURN_KEY 0x47
53 #define ENTER_KEY 0x5b
54 
55 #define LEFT_ARROW_KEY 0x61
56 #define RIGHT_ARROW_KEY 0x63
57 #define UP_ARROW_KEY 0x57
58 #define DOWN_ARROW_KEY 0x62
59 
60 #define HOME_KEY 0x20
61 #define INSERT_KEY 0x1f
62 #define END_KEY 0x35
63 #define PAGE_UP_KEY 0x21
64 #define PAGE_DOWN_KEY 0x36
65 
66 
67 #define LEFT_ARROW_KEY_CODE "\033OD"
68 #define RIGHT_ARROW_KEY_CODE "\033OC"
69 #define UP_ARROW_KEY_CODE "\033OA"
70 #define DOWN_ARROW_KEY_CODE "\033OB"
71 
72 #define SHIFT_LEFT_ARROW_KEY_CODE "\033O2D"
73 #define SHIFT_RIGHT_ARROW_KEY_CODE "\033O2C"
74 #define SHIFT_UP_ARROW_KEY_CODE "\033O2A"
75 #define SHIFT_DOWN_ARROW_KEY_CODE "\033O2B"
76 
77 #define CTRL_LEFT_ARROW_KEY_CODE "\033O5D"
78 #define CTRL_RIGHT_ARROW_KEY_CODE "\033O5C"
79 #define CTRL_UP_ARROW_KEY_CODE "\033O5A"
80 #define CTRL_DOWN_ARROW_KEY_CODE "\033O5B"
81 
82 #define DELETE_KEY_CODE		"\033[3~"
83 #define BACKSPACE_KEY_CODE	"\177"
84 
85 #define HOME_KEY_CODE "\033OH"
86 #define INSERT_KEY_CODE "\033[2~"
87 #define END_KEY_CODE "\033OF"
88 #define PAGE_UP_KEY_CODE "\033[5~"
89 #define PAGE_DOWN_KEY_CODE "\033[6~"
90 
91 #define SHIFT_HOME_KEY_CODE "\033O2H"
92 #define SHIFT_END_KEY_CODE "\033O2F"
93 
94 #define BEGIN_BRACKETED_PASTE_CODE "\033[200~"
95 #define END_BRACKETED_PASTE_CODE "\033[201~"
96 
97 //#define IS_DOWN_KEY(x) (info.key_states[(x) / 8] & key_state_table[(x) % 8])
98 #define IS_DOWN_KEY(x) \
99 (info.key_states[(x) >> 3] & (1 << (7 - ((x) % 8))))
100