1 /*======================================================================*\
2 |*		Editor mined						*|
3 |*		keyboard mappings to commands and characters		*|
4 \*======================================================================*/
5 
6 #include "mined.h"
7 #include "io.h"
8 
9 
10 /*======================================================================*\
11 |*			Key and function key -> command mapping		*|
12 \*======================================================================*/
13 
14 /* The mapping between input codes and functions */
15 
16 #define Sch (voidfunc) Scharacter
17 
18 voidfunc key_map [256] = {
19 	/* characters to functions map */
20   /* ^@ ^A ^B ^C ^D ^E ^F ^G */
21 		MARK, MPW, DCC, PGDNkey, RTkey, UPkey, MNW, GOHOP,
22   /* ^H ^I ^J ^K ^L ^M ^N ^O */
23 		DPC, Sch, Sch, DLN, HOP, SNL, RES, APPNL,
24   /* ^P ^Q ^R ^S ^T ^U ^V ^W */
25 		PASTEstay, HOP, PGUPkey, LFkey, DNW, CUT, CTRLINS, SU,
26   /* ^X ^Y ^Z ^[ ^\ ^] ^^ ^_ */
27 		DNkey, COPY, SD, ESCAPE, CANCEL, MARK, DPW, (voidfunc) BADch,
28   /* 20-2F 040-057 */	Sch, Sch, Sdoublequote, Sch, Sch, Sch, Sch, Ssinglequote,
29 		Sch, Sch, Sch, Sch, Sch, Sdash, Sch, Sch,
30   /* 30-3F 060-077 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
31   /* 40-4F 100-117 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
32   /* 50-5F 120-137 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
33   /* 60-6F 140-157 */	Sgrave, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
34   /* 70-7F 160-177 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
35 		Sch, Sch, Sch, Sch, Sch, Sch, Sch, DELchar,
36   /* 80-8F 200-217 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
37   /* 90-9F 220-237 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
38   /* A0-AF 240-257 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
39   /* B0-BF 260-277 */	Sch, Sch, Sch, Sch, Sacute, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
40   /* C0-CF 300-317 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
41   /* D0-DF 320-337 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
42   /* E0-EF 340-357 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
43   /* F0-FF 360-377 */	Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch, Sch,
44 };
45 
46 voidfunc mined_key_map [32] = {
47 	/* control characters to functions map */
48   /* ^@-^G */	MARK, MPW, DCC, PGDNkey, RTkey, UPkey, MNW, GOHOP,
49   /* ^H-^O */	DPC, Sch, Sch, DLN, HOP, SNL, RES, APPNL,
50   /* ^P-^W */	PASTEstay, HOP, PGUPkey, LFkey, DNW, CUT, CTRLINS, SU,
51   /* ^X-^_ */	DNkey, COPY, SD, ESCAPE, CANCEL, MARK, DPW, (voidfunc) BADch,
52 };
53 
54 voidfunc ws_key_map [32] = {
55 	/* control characters to functions map */
56   /* ^@-^G */	I, MPW, JUS, PGDNkey, RTkey, UPkey, MNW, DCC,
57   /* ^H-^O */	LFkey, Sch, Sch, ctrlK, RES, SNL, APPNL, ctrlO,
58   /* ^P-^W */	CTRLINS, ctrlQ, PGUPkey, LFkey, DNW, (voidfunc) BADch, TOGINS, SU,
59   /* ^X-^_ */	DNkey, DLINE, SD, ESCAPE, CANCEL, (voidfunc) BADch, (voidfunc) BADch, (voidfunc) BADch,
60 };
61 
62 voidfunc pico_key_map [32] = {
63 	/* control characters to functions map */
64   /* ^@-^G */	MNW, MOVLBEG , LFkey, FS, DCC, MOVLEND , RTkey, HELP,
65   /* ^H-^O */	DPC, Sch, JUS, DLN, RDwin, SNL, DNkey, WTU,
66   /* ^P-^W */	UPkey, I, INSFILE, I, SPELL, PASTE, PGDNkey, SFW,
67   /* ^X-^_ */	QUED, PGUPkey, I, ESCAPE, CANCEL, MARK, toggleMARK, CTRLINS,
68 };
69 
70 voidfunc emacs_key_map [32] = {
71 	/* control characters to functions map */
72   /* ^@-^G */	MARK, MOVLBEG , LFkey, I, DCC, MOVLEND , RTkey, CANCEL,
73   /* ^H-^O */	HELP, Sch, Sch, DLN, RD, SNL, DNkey, APPNL,
74   /* ^P-^W */	UPkey, CTRLINS, SRV, SFW, I, (voidfunc) REPT, PGDNkey, CUT,
75   /* ^X-^_ */	EMAX, PASTE, SUSP, META, HOP, I, HOP, UNDO,
76 };
77 
78 voidfunc windows_key_map [32] = {
79 	/* control characters to functions map */
80   /* ^@-^G */	MARK, I, I, COPY, I, I, SFW, GOHOP,
81   /* ^H-^O */	REPL, Sch, Sch, I, I, SNL, I, EDIT,
82   /* ^P-^W */	PRINT, QUED, I, WT, I, I, PASTE, CLOSEFILE,
83   /* ^X-^_ */	CUT, I, I, ESCAPE, CANCEL, I, I, CTRLINS,
84 };
85 
86 
87 /* mapping DOS extended function key codes -> functions
88    keys as delivered by djgpp function getxkey, listed in keys.h
89    first half of map is also valid for function getkey (with leading 0 byte)
90    a leading ':' means: special MSDOS key mapping
91 */
92 struct pc_fkeyentry pc_xkey_map [512] = {
93 					{I},
94 /* #define K_Alt_Escape           0x101 */	{EXED},
95 					{I},
96 /* #define K_Control_At           0x103 */	{MARK},
97 					{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
98 /* #define K_Alt_Backspace        0x10e */	{DPC, ctrl_mask},
99 /* #define K_BackTab              0x10f */	{MPW},
100 /* #define K_Alt_Q                0x110 */	{I},
101 /* #define K_Alt_W                0x111 */	{I},
102 /* #define K_Alt_E                0x112 */	{EDITMENU},
103 /* #define K_Alt_R                0x113 */	{I},
104 /* #define K_Alt_T                0x114 */	{Stag},
105 /* #define K_Alt_Y                0x115 */	{I},
106 /* #define K_Alt_U                0x116 */	{I},
107 /* #define K_Alt_I                0x117 */	{I},
108 /* #define K_Alt_O                0x118 */	{OPTIONSMENU},
109 /* #define K_Alt_P                0x119 */	{PARAMENU},
110 /* #define K_Alt_LBracket         0x11a */	{I},
111 /* #define K_Alt_RBracket         0x11b */	{I},
112 /* #define K_Alt_Return           0x11c */	{SNL, alt_mask},
113 					{I},
114 /* #define K_Alt_A                0x11e */	{I},
115 /* #define K_Alt_S                0x11f */	{SEARCHMENU},
116 /* #define K_Alt_D                0x120 */	{I},
117 /* #define K_Alt_F                0x121 */	{FILEMENU},
118 /* #define K_Alt_G                0x122 */	{I},
119 /* #define K_Alt_H                0x123 */	{HTML},
120 /* #define K_Alt_J                0x124 */	{I},
121 /* #define K_Alt_K                0x125 */	{toggleKEYMAP},
122 /* #define K_Alt_L                0x126 */	{I},
123 /* #define K_Alt_Semicolon        0x127 */	{I},
124 /* #define K_Alt_Quote            0x128 */	{I},
125 /* #define K_Alt_Backquote        0x129 */	{I},
126 					{I},
127 /* #define K_Alt_Backslash        0x12b */	{I},
128 /* #define K_Alt_Z                0x12c */	{I},
129 /* #define K_Alt_X                0x12d */	{AltX},
130 /* #define K_Alt_C                0x12e */	{I},
131 /* #define K_Alt_V                0x12f */	{I},
132 /* #define K_Alt_B                0x130 */	{I},
133 /* #define K_Alt_N                0x131 */	{I},
134 /* #define K_Alt_M                0x132 */	{I},
135 /* #define K_Alt_Comma            0x133 */	{I},
136 /* #define K_Alt_Period           0x134 */	{I},
137 /* #define K_Alt_Slash            0x135 */	{I},
138 					{I},
139 /* #define K_Alt_KPStar           0x137 */	{I},
140 					{I},
141 /* : getkey: Alt_Control_Space      0x139 */	{MARK},
142 					{I},
143 /* #define K_F1                   0x13b */	{F1},
144 /* #define K_F2                   0x13c */	{F2},
145 /* #define K_F3                   0x13d */	{F3},
146 /* #define K_F4                   0x13e */	{F4},
147 /* #define K_F5                   0x13f */	{F5},
148 /* #define K_F6                   0x140 */	{F6},
149 /* #define K_F7                   0x141 */	{F7},
150 /* #define K_F8                   0x142 */	{F8},
151 /* #define K_F9                   0x143 */	{F9},
152 /* #define K_F10                  0x144 */	{F10},
153 					{I}, {I},
154 /* #define K_Home                 0x147 */	{HOMEkey},
155 /* #define K_Up                   0x148 */	{UPkey},
156 /* #define K_PageUp               0x149 */	{PGUPkey},
157 /* : #define K_Alt_KPMinus          0x14a */	{screenlesslines, alt_mask},
158 /* #define K_Left                 0x14b */	{LFkey},
159 /* #define K_Center               0x14c */	{HOP},
160 /* #define K_Right                0x14d */	{RTkey},
161 /* : #define K_Alt_KPPlus           0x14e */	{screenmorelines, alt_mask},
162 /* #define K_End                  0x14f */	{ENDkey},
163 /* #define K_Down                 0x150 */	{DNkey},
164 /* #define K_PageDown             0x151 */	{PGDNkey},
165 /* #define K_Insert               0x152 */	{INSkey},
166 /* #define K_Delete               0x153 */	{DELkey},
167 /* #define K_Shift_F1             0x154 */	{F1, shift_mask},
168 /* #define K_Shift_F2             0x155 */	{F2, shift_mask},
169 /* #define K_Shift_F3             0x156 */	{F3, shift_mask},
170 /* #define K_Shift_F4             0x157 */	{F4, shift_mask},
171 /* #define K_Shift_F5             0x158 */	{F5, shift_mask},
172 /* #define K_Shift_F6             0x159 */	{F6, shift_mask},
173 /* #define K_Shift_F7             0x15a */	{F7, shift_mask},
174 /* #define K_Shift_F8             0x15b */	{F8, shift_mask},
175 /* #define K_Shift_F9             0x15c */	{F9, shift_mask},
176 /* #define K_Shift_F10            0x15d */	{F10, shift_mask},
177 /* #define K_Control_F1           0x15e */	{F1, ctrl_mask},
178 /* #define K_Control_F2           0x15f */	{F2, ctrl_mask},
179 /* #define K_Control_F3           0x160 */	{F3, ctrl_mask},
180 /* #define K_Control_F4           0x161 */	{F4, ctrl_mask},
181 /* #define K_Control_F5           0x162 */	{F5, ctrl_mask},
182 /* #define K_Control_F6           0x163 */	{F6, ctrl_mask},
183 /* #define K_Control_F7           0x164 */	{F7, ctrl_mask},
184 /* #define K_Control_F8           0x165 */	{F8, ctrl_mask},
185 /* #define K_Control_F9           0x166 */	{F9, ctrl_mask},
186 /* #define K_Control_F10          0x167 */	{F10, ctrl_mask},
187 /* #define K_Alt_F1               0x168 */	{F1, alt_mask},
188 /* #define K_Alt_F2               0x169 */	{F2, alt_mask},
189 /* #define K_Alt_F3               0x16a */	{F3, alt_mask},
190 /* #define K_Alt_F4               0x16b */	{F4, alt_mask},
191 /* #define K_Alt_F5               0x16c */	{F5, alt_mask},
192 /* #define K_Alt_F6               0x16d */	{F6, alt_mask},
193 /* #define K_Alt_F7               0x16e */	{F7, alt_mask},
194 /* #define K_Alt_F8               0x16f */	{F8, alt_mask},
195 /* #define K_Alt_F9               0x170 */	{F9, alt_mask},
196 /* #define K_Alt_F10              0x171 */	{F10, alt_mask},
197 /* #define K_Control_Print        0x172 */	{I},
198 /* #define K_Control_Left         0x173 */	{LFkey, ctrl_mask},
199 /* #define K_Control_Right        0x174 */	{RTkey, ctrl_mask},
200 /* #define K_Control_End          0x175 */	{ENDkey, ctrl_mask},
201 /* #define K_Control_PageDown     0x176 */	{PGDNkey, ctrl_mask},
202 /* #define K_Control_Home         0x177 */	{HOMEkey, ctrl_mask},
203 /* : #define K_Alt_1                0x178 */	{key_1, alt_mask},
204 /* : #define K_Alt_2                0x179 */	{key_2, alt_mask},
205 /* : #define K_Alt_3                0x17a */	{key_3, alt_mask},
206 /* : #define K_Alt_4                0x17b */	{key_4, alt_mask},
207 /* : #define K_Alt_5                0x17c */	{key_5, alt_mask},
208 /* : #define K_Alt_6                0x17d */	{key_6, alt_mask},
209 /* : #define K_Alt_7                0x17e */	{key_7, alt_mask},
210 /* : #define K_Alt_8                0x17f */	{key_8, alt_mask},
211 /* : #define K_Alt_9                0x180 */	{key_9, alt_mask},
212 /* : #define K_Alt_0                0x181 */	{key_0, alt_mask},
213 /* #define K_Alt_Dash             0x182 */	{I},
214 /* #define K_Alt_Equals           0x183 */	{I},
215 /* #define K_Control_PageUp       0x184 */	{PGUPkey, ctrl_mask},
216 /* #define K_F11                  0x185 */	{F11},
217 /* #define K_F12                  0x186 */	{F12},
218 /* #define K_Shift_F11            0x187 */	{F11, shift_mask},
219 /* #define K_Shift_F12            0x188 */	{F12, shift_mask},
220 /* #define K_Control_F11          0x189 */	{F11, ctrl_mask},
221 /* #define K_Control_F12          0x18a */	{F12, ctrl_mask},
222 /* #define K_Alt_F11              0x18b */	{F11, alt_mask},
223 /* #define K_Alt_F12              0x18c */	{F12, alt_mask},
224 /* #define K_Control_Up           0x18d */	{UPkey, ctrl_mask},
225 /* #define K_Control_KPDash       0x18e */	{screensmaller, ctrl_mask},
226 /* #define K_Control_Center       0x18f */	{HOP, ctrl_mask},
227 /* #define K_Control_KPPlus       0x190 */	{screenbigger, ctrl_mask},
228 /* #define K_Control_Down         0x191 */	{DNkey, ctrl_mask},
229 /* #define K_Control_Insert       0x192 */	{INSkey, ctrl_mask},
230 /* #define K_Control_Delete       0x193 */	{DELkey, ctrl_mask},
231 					{I},
232 /* : #define K_Control_KPSlash      0x195 */	{FIND},
233 /* : #define K_Control_KPStar       0x196 */	{GOHOP},
234 /* #define K_Alt_EHome            0x197 */	{smallHOMEkey, alt_mask},
235 /* #define K_Alt_EUp              0x198 */	{UPkey, alt_mask},
236 /* #define K_Alt_EPageUp          0x199 */	{PGUPkey, alt_mask},
237 					{I},
238 /* #define K_Alt_ELeft            0x19b */	{LFkey, alt_mask},
239 					{I},
240 /* #define K_Alt_ERight           0x19d */	{RTkey, alt_mask},
241 					{I},
242 /* #define K_Alt_EEnd             0x19f */	{smallENDkey, alt_mask},
243 /* #define K_Alt_EDown            0x1a0 */	{DNkey, alt_mask},
244 /* #define K_Alt_EPageDown        0x1a1 */	{PGDNkey, alt_mask},
245 /* #define K_Alt_EInsert          0x1a2 */	{smallINSkey, alt_mask},
246 /* #define K_Alt_EDelete          0x1a3 */	{smallDELkey, alt_mask},
247 /* #define K_Alt_KPSlash          0x1a4 */	{FIND, alt_mask},
248 /* #define K_Alt_Tab              0x1a5 */	{GOHOP},
249 /* #define K_Alt_Enter            0x1a6 */	{SNL, alt_mask},
250 					{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
251 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
252 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
253 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
254 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
255 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
256 
257 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
258 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
259 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
260 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
261 					{I}, {I}, {I}, {I}, {I}, {I}, {I},
262 /* #define K_EHome                0x247 */	{smallHOMEkey},
263 /* #define K_EUp                  0x248 */	{UPkey},
264 /* #define K_EPageUp              0x249 */	{PGUPkey},
265 					{I},
266 /* #define K_ELeft                0x24b */	{LFkey},
267 					{I},
268 /* #define K_ERight               0x24d */	{RTkey},
269 					{I},
270 /* #define K_EEnd                 0x24f */	{smallENDkey},
271 /* #define K_EDown                0x250 */	{DNkey},
272 /* #define K_EPageDown            0x251 */	{PGDNkey},
273 /* #define K_EInsert              0x252 */	{smallINSkey},
274 /* #define K_EDelete              0x253 */	{smallDELkey},
275 					{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
276 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
277 					{I}, {I}, {I},
278 /* #define K_Control_ELeft        0x273 */	{LFkey, ctrl_mask},
279 /* #define K_Control_ERight       0x274 */	{RTkey, ctrl_mask},
280 /* #define K_Control_EEnd         0x275 */	{smallENDkey, ctrl_mask},
281 /* #define K_Control_EPageDown    0x276 */	{PGDNkey, ctrl_mask},
282 /* #define K_Control_EHome        0x277 */	{smallHOMEkey, ctrl_mask},
283 					{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
284 					{I}, {I}, {I}, {I},
285 /* #define K_Control_EPageUp      0x284 */	{PGUPkey, ctrl_mask},
286 					{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
287 /* #define K_Control_EUp          0x28d */	{UPkey, ctrl_mask},
288 					{I}, {I}, {I},
289 /* #define K_Control_EDown        0x291 */	{DNkey, ctrl_mask},
290 /* #define K_Control_EInsert      0x292 */	{smallINSkey, ctrl_mask},
291 /* #define K_Control_EDelete      0x293 */	{smallDELkey, ctrl_mask},
292 					{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
293 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
294 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
295 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
296 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
297 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
298 	{I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I}, {I},
299 };
300 
301 
302 #ifndef msdos
303 
304 /* mapping table: function key escape sequences -> mined functions */
305 struct fkeyentry fkeymap [] = {
306 	/* Alt-Letter sequences for manual menu activation */
307 /*
308 	{"\033f",	FILEMENU},
309 	{"\033e",	EDITMENU},
310 	{"\033s",	SEARCHMENU},
311 	{"\033p",	PARAMENU},
312 	{"\033o",	OPTIONSMENU},
313 */
314 
315 	{"\033]",	OSC},
316 
317 	/* Alt-Letter sequences for keyboard switching functions
318 	   to be recognised on prompt line */
319 	{"\033k",	toggleKEYMAP},
320 	{"\033K",	setupKEYMAP},
321 	{"\033I",	setupKEYMAP},
322 	{"\033x",	AltX},
323 
324 	/* Alt-Digit sequences for diacritic combination prefixes */
325 	{"\0330", key_0, alt_mask},
326 	{"\0331", key_1, alt_mask},
327 	{"\0332", key_2, alt_mask},
328 	{"\0333", key_3, alt_mask},
329 	{"\0334", key_4, alt_mask},
330 	{"\0335", key_5, alt_mask},
331 	{"\0336", key_6, alt_mask},
332 	{"\0337", key_7, alt_mask},
333 	{"\0338", key_8, alt_mask},
334 	{"\0339", key_9, alt_mask},
335 
336 	/* VT100 and Sun */
337 	{"\033[A",	UPkey},	/* move cursor up	*/
338 	{"\033[B",	DNkey},	/* more cursor down	*/
339 	{"\033[C",	RTkey},	/* more cursor right	*/
340 	{"\033[D",	LFkey},	/* more cursor left	*/
341 
342 	/* Sun raw function key codes */
343 	{"\033[215z",	UPkey},	/* move cursor up	*/
344 	{"\033[221z",	DNkey},	/* more cursor down	*/
345 	{"\033[219z",	RTkey},	/* more cursor right	*/
346 	{"\033[217z",	LFkey},	/* more cursor left	*/
347 
348 	/* Linux console, Cygwin console */
349 	{"\033[1~",	smallHOMEkey},	/* Pos1, VT220: FIND (@0)	*/
350 	{"\033[4~",	smallENDkey},	/* End, VT220: SELECT (*6)	*/
351 	{"\033[[A",	F1},	/* F1	*/
352 	{"\033[[B",	F2},	/* F2	*/
353 	{"\033[[C",	F3},	/* F3	*/
354 	{"\033[[D",	F4},	/* F4	*/
355 	{"\033[[E",	F5},	/* F5	*/
356 	{"\033[G",	HOP},	/* 5	*/
357 
358 	/* found somewhere? */
359 	{"\033[1G",	HOP},	/* pattern for shifted 5? */
360 
361 	/* PuTTY */
362 	{"\033OG",	HOP},	/* 5	*/
363 
364 	/* Linux X / xterm */
365 	{"\033OP",	F1},	/* F1, VT100 PF1	*/
366 	{"\033OQ",	F2},	/* F2, VT100 PF2	*/
367 	{"\033OR",	F3},	/* F3, VT100 PF3	*/
368 	{"\033OS",	F4},	/* F4, VT100 PF4	*/
369 	{"\033OH",	HOMEkey},	/* Pos1	*/
370 	{"\033OF",	ENDkey},	/* End	*/
371 	{"\033OE",	HOP},	/* 5	*/
372 
373 	/* non-application mode xterm */
374 	{"\033[H",	smallHOMEkey},	/* Pos1, esp on left keypad	*/
375 	{"\033[F",	smallENDkey},	/* End, esp on left keypad	*/
376 	{"\033[E",	HOP},	/* 5, Begin, hanterm keypad 5	*/
377 
378 	/* xterm generic patterns for modified keypad keys */
379 	{"\033[1H",	HOMEkey},	/* Pos1	*/
380 	{"\033[1F",	ENDkey},	/* End	*/
381 	{"\033[1E",	HOP},	/* 5	*/
382 	{"\033[1A",	UPkey},	/* Up	*/
383 	{"\033[1D",	LFkey},	/* Left	*/
384 	{"\033[1B",	DNkey},	/* Down	*/
385 	{"\033[1C",	RTkey},	/* Right	*/
386 
387 	/* xterm generic patterns for modified function keys */
388 	{"\033[1P",	F1},	/* F1	*/
389 	{"\033[1Q",	F2},	/* F2	*/
390 	{"\033[1R",	F3},	/* F3	*/
391 	{"\033[1S",	F4},	/* F4	*/
392 
393 	/* xterm specials */
394 	{"\033[200~",	I},	/* begin bracketed paste */
395 	{"\033[201~",	I},	/* end bracketed paste */
396 
397 	/* Deprecated; mined keyboard add-ons: shifted digits etc*/
398 	{"\033[00~",	key_0},
399 	{"\033[01~",	key_1},
400 	{"\033[02~",	key_2},
401 	{"\033[03~",	key_3},
402 	{"\033[04~",	key_4},
403 	{"\033[05~",	key_5},
404 	{"\033[06~",	key_6},
405 	{"\033[07~",	key_7},
406 	{"\033[08~",	key_8},
407 	{"\033[09~",	key_9},
408 	{"\033[~",	DPC},	/* modified BackSpace (ctrl/shift) */
409 
410 	/* various modified keypad keys (non-application mode),
411 	   e.g. with xterm *VT100*modifyCursorKeys: 1 or 0;
412 	   not complete (wrt modifiers);
413 	   would be detected generically with TERM=xterm-sco
414 	 */
415 	{"\033[2H",	smallHOMEkey, shift_mask},	/* shift-Pos1	*/
416 	{"\033[2F",	smallENDkey, shift_mask},	/* shift-Ende	*/
417 	{"\033[5H",	smallHOMEkey, ctrl_mask},	/* control-Pos1	*/
418 	{"\033[5F",	smallENDkey, ctrl_mask},	/* control-Ende	*/
419 
420 	{"\0332A",	UPkey, shift_mask},	/* shift-Up	*/
421 	{"\0332B",	DNkey, shift_mask},	/* shift-Down	*/
422 	{"\0332C",	RTkey, shift_mask},	/* shift-Right	*/
423 	{"\0332D",	LFkey, shift_mask},	/* shift-Left	*/
424 	{"\0335A",	UPkey, ctrl_mask},	/* control-Up	*/
425 	{"\0335B",	DNkey, ctrl_mask},	/* control-Down	*/
426 	{"\0335C",	RTkey, ctrl_mask},	/* control-Right	*/
427 	{"\0335D",	LFkey, ctrl_mask},	/* control-Left	*/
428 	{"\0336A",	UPkey, ctrlshift_mask},	/* control-shift-Up	*/
429 	{"\0336B",	DNkey, ctrlshift_mask},	/* control-shift-Down	*/
430 	{"\0336C",	RTkey, ctrlshift_mask},	/* control-shift-Right	*/
431 	{"\0336D",	LFkey, ctrlshift_mask},	/* control-shift-Left	*/
432 
433 	/* mined shortcuts */
434 	{"\033\r",	Popmark},	/* alt-Enter	*/
435 	{"\033\n",	Popmark},	/* alt-Enter	*/
436 
437 	/* vim mouse wheel mappings for xterm */
438 	{"\033[64~",	PGUPkey},	/* shift-wheel-up */
439 	{"\033[65~",	PGDNkey},	/* shift-wheel-down */
440 	{"\033[62~",	SU},	/* wheel-up */
441 	{"\033[63~",	SD},	/* wheel-down */
442 
443 	/* various VT100-style Fn function keys */
444 	{"\033[11~",	F1},	/* F1	*/
445 	{"\033[12~",	F2},	/* F2	*/
446 	{"\033[13~",	F3},	/* F3	*/
447 	{"\033[14~",	F4},	/* F4	*/
448 	{"\033[15~",	F5},	/* F5	*/
449 	{"\033[17~",	F6},	/* F6	*/
450 	{"\033[18~",	F7},	/* F7	*/
451 	{"\033[19~",	F8},	/* F8	*/
452 	{"\033[20~",	F9},	/* F9	*/
453 	{"\033[21~",	F10},	/* F10	*/
454 
455 	/* VT220-style Fn function keys (control-Fn with xterm VT220 mode) */
456 	{"\033[23~",	F11},	/* F11 (also shift-F1)	*/
457 	{"\033[24~",	F12},	/* F12 (also shift-F2)	*/
458 	/* the following 10 (F3...F12) are also attached to Control-Fn
459 	   by xterm 216 with the "old function keys" option -
460 	   it should better not be used, especially as the DO (vt220)
461 	   sequence is ambiguously emitted by both Shift-F6 / Control-F6
462 	   and Menu keys
463 	 */
464 	{"\033[25~",	F3, shift_mask},	/* F13	*/
465 	{"\033[26~",	F4, shift_mask},	/* F14	*/
466 	{"\033[28~",	F5, shift_mask},	/* VT220: HELP (%1) */
467 	{"\033[29~",	HOP},		/* VT220: DO (%0 redo), xterm: Menu */
468 	{"\033[31~",	F7, shift_mask},	/* F17	*/
469 	{"\033[32~",	F8, shift_mask},	/* F18	*/
470 	{"\033[33~",	F9, shift_mask},	/* F19	*/
471 	{"\033[34~",	F10, shift_mask},	/* F20	*/
472 	/* xterm VT220 mode Fn function keys (control-Fn, actually),
473 	   since xterm 216, also with oldFunctionKeys mode,
474 	   also extended Fn function keys with modifyFunctionKeys disabled
475 	 */
476 	{"\033[42~",	F11, shift_mask}, /* F11 (also control-F1) */
477 	{"\033[43~",	F12, shift_mask}, /* F12 (also control-F2) */
478 
479 	/* xterm extended Fn function keys with modifyFunctionKeys disabled,
480 	   since xterm 216
481 	 */
482 	{"\033[44~",	F3, ctrl_mask}, /* control-F3 */
483 	{"\033[45~",	F4, ctrl_mask}, /* control-F4 */
484 	{"\033[46~",	F5, ctrl_mask}, /* control-F5 */
485 	{"\033[47~",	F6, ctrl_mask}, /* control-F6 */
486 	{"\033[48~",	F7, ctrl_mask}, /* control-F7 */
487 	{"\033[49~",	F8, ctrl_mask}, /* control-F8 */
488 	{"\033[50~",	F9, ctrl_mask}, /* control-F9 */
489 	{"\033[51~",	F10, ctrl_mask}, /* control-F10 */
490 	{"\033[52~",	F11, ctrl_mask}, /* control-F11 (also ctrl-shft-F1) */
491 	{"\033[53~",	F12, ctrl_mask}, /* control-F12 (also ctrl-shft-F2) */
492 
493 	{"\033[54~",	F3, ctrlshift_mask}, /* control-shift-F3 */
494 	{"\033[55~",	F4, ctrlshift_mask}, /* control-shift-F4 */
495 	{"\033[56~",	F5, ctrlshift_mask}, /* control-shift-F5 */
496 	{"\033[57~",	F6, ctrlshift_mask}, /* control-shift-F6 */
497 	{"\033[58~",	F7, ctrlshift_mask}, /* control-shift-F7 */
498 	{"\033[59~",	F8, ctrlshift_mask}, /* control-shift-F8 */
499 	{"\033[60~",	F9, ctrlshift_mask}, /* control-shift-F9 */
500 	{"\033[61~",	F10, ctrlshift_mask}, /* control-shift-F10 */
501 	{"\033[62~",	F11, ctrlshift_mask}, /* control-shift-F11 */
502 	{"\033[63~",	F12, ctrlshift_mask}, /* control-shift-F12 */
503 
504 	/* further VT100 keys - some have been disabled by linux sequences */
505 	{"\033[6~",	PGDNkey},	/* Next Screen, xterm PgDn	*/
506 	{"\033[5~",	PGUPkey},	/* Prev Screen, xterm PgUp	*/
507 	{"\033[3~",	DELkey},	/* Remove, xterm Del	*/
508 	{"\033[2~",	INSkey},	/* Insert Here, xterm Ins	*/
509 	{"\033[@",	HOMEkey},	/* Pos1, PC-xterm	*/
510 	{"\033[e",	ENDkey},	/* End, PC-xterm	*/
511 
512 	/* application cursor keys */
513 	{"\033OA",	UPkey},	/* up	*/
514 	{"\033OB",	DNkey},	/* dn	*/
515 	{"\033OC",	RTkey},	/* rt	*/
516 	{"\033OD",	LFkey},	/* lf	*/
517 	{"\033O@",	HOMEkey},	/* Pos1, PC-xterm	*/
518 	{"\033Oe",	ENDkey},	/* End, PC-xterm	*/
519 
520 	/* application keypad */
521 	{"\033O ",	HOP},	/* Space, also old hanterm keypad 5 ?	*/
522 	{"\033OI",	HOP},	/* shift-Tab */
523 	{"\033OM",	SNL},	/* Enter (@8) */
524 	{"\033Oo",	FIND},	/* PF1, keypad /	*/
525 	{"\033Oj",	GOHOP},	/* PF2, keypad *	*/
526 	{"\033Om",	SU},	/* PF3, keypad -	*/
527 	{"\033Ok",	SD},	/* PF4, keypad +	*/
528 
529 	{"\033Op",	INSkey},	/* Ins (kI), keypad 0	*/
530 	{"\033Oq",	ENDkey},	/* End (K4), keypad 1	*/
531 	{"\033Or",	DNkey},		/* dn (kd), keypad 2	*/
532 	{"\033Os",	PGDNkey},	/* PgDn (K5), keypad 3	*/
533 	{"\033Ot",	LFkey},		/* lf (kl), keypad 4	*/
534 	{"\033Ou",	HOP},		/* mid (K2), keypad 5	*/
535 	{"\033Ov",	RTkey},		/* rt (kr), keypad 6	*/
536 	{"\033Ow",	HOMEkey},	/* Pos1 (K1), keypad 7	*/
537 	{"\033Ox",	UPkey},		/* up (ku), keypad 8	*/
538 	{"\033Oy",	PGUPkey},	/* PgUp (K3), keypad 9	*/
539 	{"\033On",	DELkey},	/* Del (kD), keypad .	*/
540 	{"\033Ol",	DELkey},	/* Del, keypad ,	*/
541 
542 	/* mintty generic patterns for modified application mode keys */
543 	{"\033[1p",	INSkey},	/* Ins (kI), keypad 0	*/
544 	{"\033[1q",	ENDkey},	/* End (K4), keypad 1	*/
545 	{"\033[1r",	DNkey},		/* dn (kd), keypad 2	*/
546 	{"\033[1s",	PGDNkey},	/* PgDn (K5), keypad 3	*/
547 	{"\033[1t",	LFkey},		/* lf (kl), keypad 4	*/
548 	{"\033[1u",	HOP},		/* mid (K2), keypad 5	*/
549 	{"\033[1v",	RTkey},		/* rt (kr), keypad 6	*/
550 	{"\033[1w",	HOMEkey},	/* Pos1 (K1), keypad 7	*/
551 	{"\033[1x",	UPkey},		/* up (ku), keypad 8	*/
552 	{"\033[1y",	PGUPkey},	/* PgUp (K3), keypad 9	*/
553 	{"\033[1n",	DELkey},	/* Del (kD), keypad .	*/
554 	{"\033[1l",	DELkey},	/* Del, keypad ,	*/
555 	{"\033[1M",	SNL},		/* Enter (@8) */
556 	{"\033[1o",	FIND},		/* keypad /	*/
557 	{"\033[1j",	GOHOP},		/* keypad *	*/
558 	{"\033[1m",	KP_minus},	/* keypad -	*/
559 	{"\033[1k",	KP_plus},	/* keypad +	*/
560 
561 	/* mintty generic patterns for modified TAB */
562 	{"\033[1Z",	STAB},	/* TAB	*/
563 
564 	/* mlterm generic patterns for modified application mode keys */
565 	{"\033O0p",	INSkey},	/* Ins (kI), keypad 0	*/
566 	{"\033O0q",	ENDkey},	/* End (K4), keypad 1	*/
567 	{"\033O0r",	DNkey},		/* dn (kd), keypad 2	*/
568 	{"\033O0s",	PGDNkey},	/* PgDn (K5), keypad 3	*/
569 	{"\033O0t",	LFkey},		/* lf (kl), keypad 4	*/
570 	{"\033O0u",	HOP},		/* mid (K2), keypad 5	*/
571 	{"\033O0v",	RTkey},		/* rt (kr), keypad 6	*/
572 	{"\033O0w",	HOMEkey},	/* Pos1 (K1), keypad 7	*/
573 	{"\033O0x",	UPkey},		/* up (ku), keypad 8	*/
574 	{"\033O0y",	PGUPkey},	/* PgUp (K3), keypad 9	*/
575 	{"\033O0n",	DELkey},	/* Del (kD), keypad .	*/
576 	{"\033O0o",	FIND},		/* keypad /	*/
577 	{"\033O0j",	GOHOP},		/* keypad *	*/
578 	{"\033O0m",	KP_minus},	/* keypad -	*/
579 	{"\033O0k",	KP_plus},	/* keypad +	*/
580 
581 	/* Sun */
582 	{"\033[208z",	F6, shift_mask},	/* R1 -> grave */
583 	{"\033[209z",	F6, ctrl_mask},		/* R2 -> circumflex */
584 	{"\033[210z",	F6},			/* R3 -> acute */
585 	{"\033[211z",	F5},			/* R4 -> diaeresis */
586 	{"\033[212z",	F5, shift_mask},	/* R5 -> tilde */
587 	{"\033[213z",	F5, ctrl_mask},		/* R6 -> angstrom */
588 	{"\033[214z",	SU},	/* R7	*/
589 	{"\033[216z",	PGUPkey},	/* R9	*/
590 	{"\033[218z",	HOP},	/* R11	*/
591 	{"\033[220z",	SD},	/* R13	*/
592 	{"\033[222z",	PGDNkey},	/* R15	*/
593 	{"\033[254z",	GOMA},	/* - */
594 	{"\033[253z",	MARK},	/* + */
595 	{"\033[250z",	COPY},	/* Enter */
596 	{"\033[249z",	DELkey},	/* Del */
597 	{"\033[247z",	INSkey, ctrl_mask},	/* Ins */
598 	{"\033[1z",	HOMEkey},	/* Home/Pos1, non-appl */
599 	{"\033[4z",	ENDkey},	/* End, non-appl */
600 	{"\033[2z",	INSkey},	/* Ins on VT100 block */
601 	{"\033[3z",	DELkey},	/* Del (xterm/Sun) */
602 	{"\033[5z",	PGUPkey},	/* PgUp on VT100 block */
603 	{"\033[6z",	PGDNkey},	/* PgDn on VT100 block */
604 	{"\033[192z",	MARK},	/* Stop (F11 with xterm "Sun Function-Keys") */
605 	{"\033[193z",	AGAIN},	/* Again (F12 with xterm "Sun Function-Keys") */
606 	{"\033[194z",	FS},	/* Props */
607 	{"\033[195z",	I},	/* Undo */
608 	{"\033[197z",	COPY},	/* Copy */
609 	{"\033[199z",	INSkey},	/* Paste */
610 	{"\033[200z",	FIND},	/* Find */
611 	{"\033[201z",	CUT},	/* Cut */
612 	{"\033[196z",	HELP},	/* Help */
613 
614 	{"\033[224z",	F1},	/* F1, xterm "Sun Function-Keys" */
615 	{"\033[225z",	F2},	/* F2 */
616 	{"\033[226z",	F3},	/* F3 */
617 	{"\033[227z",	F4},	/* F4 */
618 	{"\033[228z",	F5},	/* F5 */
619 	{"\033[229z",	F6},	/* F6 */
620 	{"\033[230z",	F7},	/* F7 */
621 	{"\033[231z",	F8},	/* F8 */
622 	{"\033[232z",	F9},	/* F9 */
623 	{"\033[233z",	F10},	/* F10 */
624 	{"\033[234z",	F11},	/* F11 */
625 	{"\033[235z",	F12},	/* F12 */
626 
627 	/* Iris */
628 	{"\033[209q",	HOMEkey},	/* Print Screen */
629 	{"\033[213q",	ENDkey},	/* Scroll Lock */
630 /*	{"\033[217q",	I},	*//* Pause */
631 	{"\033[139q",	INSkey},	/* Insert, Ins */
632 	{"\033[P",	DELkey},	/* Del */
633 /*	{"\033[H",	smallHOMEkey},	*//* Home */
634 	{"\033[150q",	PGUPkey},	/* PgUp */
635 	{"\033[146q",	smallENDkey},	/* End */
636 	{"\033[154q",	PGDNkey},	/* PgDn */
637 	{"\033[000q",	HOP},	/* 5 */
638 	{"\033[001q",	F1},	/* F1 */
639 	{"\033[002q",	F2},	/* F2 */
640 	{"\033[003q",	F3},	/* F3 */
641 	{"\033[004q",	F4},	/* F4 */
642 	{"\033[005q",	F5},	/* F5 */
643 	{"\033[006q",	F6},	/* F6 */
644 	{"\033[007q",	F7},	/* F7 */
645 	{"\033[008q",	F8},	/* F8 */
646 	{"\033[009q",	F9},	/* F9 */
647 	{"\033[010q",	F10},	/* F10 */
648 	{"\033[011q",	F11},	/* F11 */
649 	{"\033[012q",	F12},	/* F12 */
650 	{"\033[013q",	F1, shift_mask},	/* shift-F1 ? */
651 	{"\033[014q",	F2, shift_mask},	/* shift-F2 ? */
652 	{"\033[015q",	F3, shift_mask},	/* shift-F3 ? */
653 	{"\033[016q",	F4, shift_mask},	/* shift-F4 ? */
654 	{"\033[017q",	F5, shift_mask},	/* shift-F5 ? */
655 	{"\033[018q",	F6, shift_mask},	/* shift-F6 ? */
656 	{"\033[019q",	F7, shift_mask},	/* shift-F7 ? */
657 	{"\033[020q",	F8, shift_mask},	/* shift-F8 ? */
658 	{"\033[021q",	F9, shift_mask},	/* shift-F9 ? */
659 	{"\033[022q",	F10, shift_mask},	/* shift-F10 */
660 	{"\033[023q",	F11, shift_mask},	/* shift-F11 */
661 	{"\033[024q",	F12, shift_mask},	/* shift-F12 */
662 
663 	/* VT100+, older xterm, Mach console, AT&T, QNX ansi */
664 	{"\033OT",	F5},	/* F5	*/
665 	{"\033OU",	F6},	/* F6	*/
666 	{"\033OV",	F7},	/* F7	*/
667 	{"\033OW",	F8},	/* F8	*/
668 	{"\033OX",	F9},	/* F9, conflict with VT102 appl. mode =	*/
669 	{"\033OY",	F10},	/* F10	*/
670 	{"\033OZ",	F11},	/* F11	*/
671 
672 	/* rxvt */
673 	{"\033[7~",	smallHOMEkey},	/* 	*/
674 	{"\033[8~",	smallENDkey},	/* 	*/
675 	{"\033[Z",	HOP},	/* shift-TAB, also mintty */
676 
677 	/* SCO ansi */
678 	{"\033[L",	INSkey},	/* (termcap: insert character) */
679 
680 	/* xterm mouse */
681 	{"\033[M",	DIRECTxterm},	/* direct cursor address */
682 	{"\033[t",	TRACKxterm},	/* xterm mouse highlight tracking */
683 	{"\033[T",	TRACKxtermT},	/* xterm mouse highlight tracking */
684 	{"\033[O",	FOCUSout},	/* window loses focus */
685 	{"\033[I",	FOCUSin},	/* window gains focus */
686 
687 	/* DEC locator */
688 	{"\033[&w",	DIRECTvtlocator},	/* DECterm locator */
689 
690 	/* mintty ambiguous width change report */
691 	{"\033[1W",	AMBIGnarrow},	/* ambig. width chars are narrow */
692 	{"\033[2W",	AMBIGwide},	/* ambig. width chars are wide */
693 
694 	/* mintty application escape key mode (enabled with ^[[?7727h) */
695 	{"\033O[",	ESCAPE},	/* ESC */
696 
697 	/* crttool */
698 	{"\033m",	DIRECTcrttool},	/* direct cursor address */
699 
700 	{NIL_PTR}
701 };
702 
703 struct fkeyentry fkeymap_vt52 [] = {
704 	/* VT52 and HP */
705 	{"\033A",	UPkey},	/* up	*/
706 	{"\033B",	DNkey},	/* dn	*/
707 	{"\033C",	RTkey},	/* rt	*/
708 	{"\033D",	LFkey},	/* lf	*/
709 	{"\033P",	F1},	/* PF1 */
710 	{"\033Q",	F2},	/* PF2 */
711 	{"\033R",	F3},	/* PF3 */
712 	{"\033S",	F4},	/* PF4 */
713 
714 	/* keypad application mode */
715 	{"\033?p",	INSkey},	/* keypad 0 */
716 	{"\033?q",	ENDkey},	/* keypad 1 */
717 	{"\033?r",	DNkey},	/* keypad 2 */
718 	{"\033?s",	PGDNkey},	/* keypad 3 */
719 	{"\033?t",	LFkey},	/* keypad 4 */
720 	{"\033?u",	HOP},	/* keypad 5 */
721 	{"\033?v",	RTkey},	/* keypad 6 */
722 	{"\033?w",	HOMEkey},	/* keypad 7 */
723 	{"\033?x",	UPkey},	/* keypad 8 */
724 	{"\033?y",	PGUPkey},	/* keypad 9 */
725 	{"\033?l",	DELkey},	/* keypad , */
726 	{"\033?m",	SU},	/* keypad - */
727 	{"\033?n",	DELkey},	/* keypad . */
728 	{"\033?M",	SNL},	/* keypad ENTER */
729 
730 	/* xterm/VT52 application mode */
731 	{"\033?j",	GOHOP},	/* keypad * */
732 	{"\033?k",	SD},	/* keypad + */
733 	{"\033?o",	FIND},	/* keypad / */
734 	{"\033?X",	HOP},	/* keypad = */
735 	{"\033?I",	STAB},	/* Tab */
736 	{"\033? ",	SSPACE},	/* Space ? */
737 
738 	/* xterm/VT52 */
739 	{"\033H",	HOMEkey},	/* Pos1	*/
740 	{"\033F",	ENDkey},	/* End	*/
741 	{"\033E",	HOP},		/* keypad 5	*/
742 	{"\0331H",	HOMEkey},	/* modified Pos1	*/
743 	{"\0331F",	ENDkey},	/* modified End	*/
744 	{"\0331E",	HOP},		/* modified keypad 5	*/
745 	{"\0331A",	UPkey},	/* modified up	*/
746 	{"\0331B",	DNkey},	/* modified dn	*/
747 	{"\0331C",	RTkey},	/* modified rt	*/
748 	{"\0331D",	LFkey},	/* modified lf	*/
749 	{"\0331P",	F1},	/* modified PF1 (could be) */
750 	{"\0331Q",	F2},	/* modified PF2 (could be) */
751 	{"\0331R",	F3},	/* modified PF3 (could be) */
752 	{"\0331S",	F4},	/* modified PF4 (could be) */
753 
754 	{NIL_PTR}
755 };
756 
757 struct fkeyentry fkeymap_hp [] = {
758 	/* VT52 and HP */
759 	{"\033A",	UPkey},	/* up	*/
760 	{"\033B",	DNkey},	/* dn	*/
761 	{"\033C",	RTkey},	/* rt	*/
762 	{"\033D",	LFkey},	/* lf	*/
763 	{"\033P",	DELkey}, /* VT52 PF1 Del */
764 	{"\033Q",	INSkey}, /* VT52 PF2 Ins (termcap: insert character) */
765 	{"\033R",	HOP},	/* VT52 PF3 */
766 	{"\033S",	PGDNkey}, /* VT52 PF4
767 				   termcap xterm-hp: PgDn
768 				   termcap hp*: scroll-forward/backward key
769 				  */
770 	/* HP */
771 	{"\033T",	PGUPkey}, /* termcap xterm-hp: PgUp
772 				   termcap hp*: scroll-backward/forward key
773 				  */
774 	{"\033h",	HOMEkey},	/* Pos1	*/
775 	{"\033F",	ENDkey},	/* End	*/
776 	{"\033V",	PGUPkey},
777 	{"\033U",	PGDNkey},
778 	{"\033L",	APPNL},	/* insert line	*/
779 	{"\033J",	DELchar},	/* erase (clear to (end of) screen)	*/
780 	{"\033K",	DLN},	/* clear to end of line	*/
781 	{"\033M",	DLINE},	/* delete line	*/
782 	{"\033i",	MPW},	/* back-tab	*/
783 	{"\033p",	F1},	/* F1 */
784 	{"\033q",	F2},	/* F2 */
785 	{"\033r",	F3},	/* F3 */
786 	{"\033s",	F4},	/* F4 */
787 	{"\033t",	F5},	/* F5 */
788 	{"\033u",	F6},	/* F6 */
789 	{"\033v",	F7},	/* F7 */
790 	{"\033w",	F8},	/* F8 */
791 
792 	/* xterm HP mode generic patterns for modified function keys */
793 	{"\033[1p",	F1},	/* F1 */
794 	{"\033[1q",	F2},	/* F2 */
795 	{"\033[1r",	F3},	/* F3 */
796 	{"\033[1s",	F4},	/* F4 */
797 	{"\033[1t",	F5},	/* F5 */
798 	{"\033[1u",	F6},	/* F6 */
799 	{"\033[1v",	F7},	/* F7 */
800 	{"\033[1w",	F8},	/* F8 */
801 
802 	/* xterm HP mode generic patterns for modified keypad keys */
803 	{"\033[1h",	HOMEkey},	/* Pos1	*/
804 	{"\033[1T",	PGUPkey},	/* PgUp */
805 	{"\033[1S",	PGDNkey},	/* PgDn */
806 	{"\033[1Q",	INSkey},	/* Ins */
807 	{"\033[1P",	DELkey},	/* Del */
808 
809 	/* crttool */
810 /*	{"\033m",	DIRECTcrttool},	direct cursor address */
811 
812 	/* ?? */
813 	{"\033&",	SNL},	/* keypad Enter */
814 
815 	{NIL_PTR}
816 };
817 
818 #ifdef hp_console_dont_know_how_to_trigger_this
819 	/* HP workstation keyboard without NumLock */
820 	/* conflicts with VT100+ etc, see above */
821 	{"\033OU",	MARK},	/* Pos1	*/
822 	{"\033OV",	LFkey},
823 	{"\033OW",	UPkey},
824 	{"\033OX",	RTkey},
825 	{"\033OY",	DNkey},
826 	{"\033OZ",	PGUPkey},	/* PgUp	*/
827 	{"\033O?",	PGDNkey},	/* PgDn; End, Ins, Del?	*/
828 #endif
829 
830 struct fkeyentry fkeymap_rxvt [] = {
831 	/* rxvt */
832 	{"\033[2~",	INSkey, ctrl_mask},	/* small keypad Ins key	*/
833 	{"\033[3~",	DELkey, ctrl_mask},	/* small keypad Del key	*/
834 	/* xterm */
835 	{"\033[M",	DIRECTxterm},	/* direct cursor address */
836 	/* Shift-function keys: shifted by 2 against older conventions */
837 	{"\033[23~",	F11},	/* F11, shift-F1 */
838 	{"\033[24~",	F12},	/* F12, shift-F2 */
839 	{"\033[25~",	F3, shift_mask},
840 	{"\033[26~",	F4, shift_mask},
841 	{"\033[28~",	F5, shift_mask},
842 	{"\033[29~",	F6, shift_mask},
843 	{"\033[31~",	F7, shift_mask},
844 	{"\033[32~",	F8, shift_mask},
845 	{"\033[33~",	F9, shift_mask},
846 	{"\033[34~",	F10, shift_mask},
847 	{"\033[23$",	F11, shift_mask},
848 	{"\033[24$",	F12, shift_mask},
849 
850 	/* rxvt-unicode application keypad */
851 	{"\033OU",	HOMEkey},	/* Pos1	*/
852 	{"\033OV",	LFkey},	/* lf	*/
853 	{"\033OW",	UPkey},	/* up	*/
854 	{"\033OX",	RTkey},	/* rt	*/
855 	{"\033OY",	DNkey},	/* dn	*/
856 	{"\033OZ",	PGUPkey},	/* PgUp	*/
857 	{"\033O]",	HOP},	/* 5	*/
858 	{"\033O\\",	ENDkey},	/* End	*/
859 	{"\033O[",	PGDNkey},	/* PgDn	*/
860 	{"\033O^",	INSkey},	/* Ins	*/
861 	{"\033O_",	DELkey},	/* Del	*/
862 
863 	{NIL_PTR}
864 };
865 
866 struct fkeyentry fkeymap_linux [] = {
867 	/* Linux console F-keys */
868 	{"\033[23~",	F11},
869 	{"\033[24~",	F12},
870 	{"\033[25~",	F1, shift_mask},
871 	{"\033[26~",	F2, shift_mask},
872 	{"\033[28~",	F3, shift_mask},
873 	{"\033[29~",	F4, shift_mask},
874 	{"\033[31~",	F5, shift_mask},
875 	{"\033[32~",	F6, shift_mask},
876 	{"\033[33~",	F7, shift_mask},
877 	{"\033[34~",	F8, shift_mask},
878 
879 	/* override terminfo-derived settings */
880 	{"\033[1~",	smallHOMEkey},	/* small Pos1	*/
881 	{"\033[4~",	smallENDkey},	/* small End	*/
882 	{"\033[3~",	smallDELkey},	/* small Del	*/
883 
884 	{NIL_PTR}
885 };
886 
887 struct fkeyentry fkeymap_xterm [] = {
888 	/* xterm */
889 	{"\033[M",	DIRECTxterm},	/* direct cursor address */
890 	{"\033[t",	TRACKxterm},	/* xterm mouse highlight tracking */
891 	{"\033[T",	TRACKxtermT},	/* xterm mouse highlight tracking */
892 	{"\033[O",	FOCUSout},	/* window loses focus */
893 	{"\033[I",	FOCUSin},	/* window gains focus */
894 
895 	/* override wrong terminfo-derived settings */
896 	{"\033[1~",	smallHOMEkey},	/* small Pos1	*/
897 	{"\033[4~",	smallENDkey},	/* small End	*/
898 
899 	{NIL_PTR}
900 };
901 
902 struct fkeyentry fkeymap_vt100 [] = {
903 	{"\033OX",	HOP},	/* appl. mode =, conflict with older xterm F9 */
904 
905 	/* override wrong terminfo-derived settings */
906 	{"\033Op",	INSkey},	/* Ins (kI), keypad 0	*/
907 	{"\033Oq",	ENDkey},	/* End (K4), keypad 1	*/
908 	{"\033Or",	DNkey},		/* dn (kd), keypad 2	*/
909 	{"\033Os",	PGDNkey},	/* PgDn (K5), keypad 3	*/
910 	{"\033Ot",	LFkey},		/* lf (kl), keypad 4	*/
911 	{"\033Ou",	HOP},		/* mid (K2), keypad 5	*/
912 	{"\033Ov",	RTkey},		/* rt (kr), keypad 6	*/
913 	{"\033Ow",	HOMEkey},	/* Pos1 (K1), keypad 7	*/
914 	{"\033Ox",	UPkey},		/* up (ku), keypad 8	*/
915 	{"\033Oy",	PGUPkey},	/* PgUp (K3), keypad 9	*/
916 	{"\033On",	DELkey},	/* Del (kD), keypad .	*/
917 	{"\033Ol",	DELkey},	/* Del, keypad ,	*/
918 
919 	/* BSD console */
920 	{"\033[7~",	HOMEkey},	/* 	*/
921 	{"\033[8~",	ENDkey},	/* 	*/
922 
923 	{NIL_PTR}
924 };
925 
926 struct fkeyentry fkeymap_scoansi [] = {
927 	{"\033[M",	F1},	/* F1 */
928 	{"\033[N",	F2},	/* F2 */
929 	{"\033[O",	F3},	/* F3 */
930 	{"\033[P",	F4},	/* F4 */
931 	{"\033[Q",	F5},	/* F5 */
932 	{"\033[R",	F6},	/* F6 */
933 	{"\033[S",	F7},	/* F7 */
934 	{"\033[T",	F8},	/* F8 */
935 	{"\033[U",	F9},	/* F9 */
936 	{"\033[V",	F10},	/* F10 */
937 	{"\033[W",	F11},	/* F11, PuTTY SCO */
938 	{"\033[X",	F12},	/* F12, PuTTY SCO */
939 	{"\033[Y",	F1, shift_mask},	/* shift-F1, PuTTY SCO */
940 	{"\033[Z",	F2, shift_mask},	/* shift-F2, PuTTY SCO */
941 	{"\033[a",	F3, shift_mask},	/* shift-F3, PuTTY SCO */
942 	{"\033[b",	F4, shift_mask},	/* shift-F4, PuTTY SCO */
943 	{"\033[c",	F5, shift_mask},	/* shift-F5, PuTTY SCO */
944 	{"\033[d",	F6, shift_mask},	/* shift-F6, PuTTY SCO */
945 	{"\033[e",	F7, shift_mask},	/* shift-F7, PuTTY SCO */
946 	{"\033[f",	F8, shift_mask},	/* shift-F8, PuTTY SCO */
947 	{"\033[g",	F9, shift_mask},	/* shift-F9, PuTTY SCO */
948 	{"\033[h",	F10, shift_mask},	/* shift-F10, PuTTY SCO */
949 	{"\033[i",	F11, shift_mask},	/* shift-F11, PuTTY SCO */
950 	{"\033[j",	F12, shift_mask},	/* shift-F12, PuTTY SCO */
951 	{"\033[k",	F1, ctrl_mask},	/* control-F1, PuTTY SCO */
952 	{"\033[l",	F2, ctrl_mask},	/* control-F2, PuTTY SCO */
953 	{"\033[m",	F3, ctrl_mask},	/* control-F3, PuTTY SCO */
954 	{"\033[n",	F4, ctrl_mask},	/* control-F4, PuTTY SCO */
955 	{"\033[o",	F5, ctrl_mask},	/* control-F5, PuTTY SCO */
956 	{"\033[p",	F6, ctrl_mask},	/* control-F6, PuTTY SCO */
957 	{"\033[q",	F7, ctrl_mask},	/* control-F7, PuTTY SCO */
958 	{"\033[r",	F8, ctrl_mask},	/* control-F8, PuTTY SCO */
959 	{"\033[s",	F9, ctrl_mask},	/* control-F9, PuTTY SCO */
960 	{"\033[t",	F10, ctrl_mask},	/* control-F10, PuTTY SCO */
961 	{"\033[u",	F11, ctrl_mask},	/* control-F11, PuTTY SCO */
962 	{"\033[v",	F12, ctrl_mask},	/* control-F12, PuTTY SCO */
963 	{"\033OA",	UPkey, ctrl_mask},	/* control-up, PuTTY SCO */
964 	{"\033OB",	DNkey, ctrl_mask},	/* control-dn, PuTTY SCO */
965 	{"\033OC",	RTkey, ctrl_mask},	/* control-rt, PuTTY SCO */
966 	{"\033OD",	LFkey, ctrl_mask},	/* control-lf, PuTTY SCO */
967 	{"\033[L",	INSkey},	/* (termcap: insert character) */
968 	{"\033[H",	HOMEkey},	/* 	*/
969 	{"\033[F",	ENDkey},	/* (xterm-sco)	*/
970 	{"\033[G",	PGDNkey},	/* 	*/
971 	{"\033[I",	PGUPkey},	/* 	*/
972 
973 	{NIL_PTR}
974 };
975 
976 struct fkeyentry fkeymap_interix [] = {
977 	/* Interix console ("Windows Services for UNIX") */
978 	{"\033[H",	HOMEkey},
979 	{"\033[S",	PGUPkey},
980 	{"\033[T",	PGDNkey},
981 	{"\033[U",	ENDkey},
982 	{"\033[F-",	UPkey, shift_mask},
983 	{"\033[F+",	DNkey, shift_mask},
984 	{"\033[F$",	RTkey, shift_mask},
985 	{"\033[F^",	LFkey, shift_mask},
986 	{"\033[L",	INSkey},
987 /*	{"\037",	DELkey, ctrl_mask},	ctrl-DEL sends ^_ */
988 
989 	{"\033F1",	F1},
990 	{"\033F2",	F2},
991 	{"\033F3",	F3},
992 	{"\033F4",	F4},
993 	{"\033F5",	F5},
994 	{"\033F6",	F6},
995 	{"\033F7",	F7},
996 	{"\033F8",	F8},
997 	{"\033F9",	F9},
998 	{"\033FA",	F10},
999 	{"\033FB",	F11},
1000 	{"\033FC",	F12},
1001 	{"\033FD",	F1, shift_mask},
1002 	{"\033FE",	F2, shift_mask},
1003 	{"\033FF",	F3, shift_mask},
1004 	{"\033FG",	F4, shift_mask},
1005 	{"\033FH",	F5, shift_mask},
1006 	{"\033FI",	F6, shift_mask},
1007 	{"\033FJ",	F7, shift_mask},
1008 	{"\033FK",	F8, shift_mask},
1009 	{"\033FL",	F9, shift_mask},
1010 	{"\033FM",	F10, shift_mask},
1011 	{"\033FN",	F11, shift_mask},
1012 	{"\033FO",	F12, shift_mask},
1013 	{"\033FP",	F1, alt_mask},
1014 	{"\033FQ",	F2, alt_mask},
1015 	{"\033FR",	F3, alt_mask},
1016 	{"\033FS",	F4, alt_mask},
1017 	{"\033FT",	F5, alt_mask},
1018 	{"\033FU",	F6, alt_mask},
1019 	{"\033FV",	F7, alt_mask},
1020 	{"\033FW",	F8, alt_mask},
1021 	{"\033FX",	F9, alt_mask},
1022 	{"\033FY",	F10, alt_mask},
1023 	{"\033FZ",	F11, alt_mask},
1024 	{"\033Fa",	F12, alt_mask},
1025 	{"\033Fb",	F1, ctrl_mask},
1026 	{"\033Fc",	F2, ctrl_mask},
1027 	{"\033Fd",	F3, ctrl_mask},
1028 	{"\033Fe",	F4, ctrl_mask},
1029 	{"\033Ff",	F5, ctrl_mask},
1030 	{"\033Fg",	F6, ctrl_mask},
1031 	{"\033Fh",	F7, ctrl_mask},
1032 	{"\033Fi",	F8, ctrl_mask},
1033 	{"\033Fj",	F9, ctrl_mask},
1034 	{"\033Fk",	F10, ctrl_mask},
1035 	{"\033Fm",	F11, ctrl_mask},
1036 	{"\033Fn",	F12, ctrl_mask},
1037 	{"\033Fo",	F1, ctrlshift_mask},
1038 	{"\033Fp",	F2, ctrlshift_mask},
1039 	{"\033Fq",	F3, ctrlshift_mask},
1040 	{"\033Fr",	F4, ctrlshift_mask},
1041 	{"\033Fs",	F5, ctrlshift_mask},
1042 	{"\033Ft",	F6, ctrlshift_mask},
1043 	{"\033Fu",	F7, ctrlshift_mask},
1044 	{"\033Fv",	F8, ctrlshift_mask},
1045 	{"\033Fw",	F9, ctrlshift_mask},
1046 	{"\033Fx",	F10, ctrlshift_mask},
1047 	{"\033Fy",	F11, ctrlshift_mask},
1048 	{"\033Fz",	F12, ctrlshift_mask},
1049 
1050 	{NIL_PTR}
1051 };
1052 
1053 struct fkeyentry fkeymap_siemens [] = {
1054 	/* Siemens 97801/97808 */
1055 	{"\033[Z",	MPW},		/* |<- */
1056 	{"\0339",	MPW},		/* <~- */
1057 	{"\033:",	MNW},		/* -~> */
1058 	{"\0336",	HOP},		/* key next to END, above cursor block */
1059 	{"\033[@",	INSkey},	/* Insert */
1060 	{"\033[S",	PGUPkey},
1061 	{"\033[T",	PGDNkey},
1062 	{"\033^",	HOP},
1063 
1064 	{"\033@",	F1},	/* F1 */
1065 	{"\033A",	F2},	/* F2 */
1066 	{"\033B",	F3},	/* F3 */
1067 	{"\033C",	F4},	/* F4 */
1068 	{"\033D",	F5},	/* F5 */
1069 	{"\033F",	F6},	/* F6 */
1070 	{"\033G",	F7},	/* F7 */
1071 	{"\033H",	F8},	/* F8 */
1072 	{"\033I",	F9},	/* F9 */
1073 	{"\033J",	F10},	/* F10 */
1074 	{"\033K",	F11},	/* F11 */
1075 	{"\033L",	F12},	/* F12 */
1076 	{"\033M",	F3, ctrl_mask},	/* F13 */
1077 	{"\033N",	F4, ctrl_mask},	/* F14 */
1078 	{"\033O",	F5, ctrl_mask},	/* F15 */
1079 	{"\033P",	F6, ctrl_mask},	/* F16 */
1080 	{"\0330",	F7, ctrl_mask},	/* F17 */
1081 	{"\033_",	F8, ctrl_mask},	/* F18 */
1082 	{"\033d",	F9, ctrl_mask},	/* F19 */
1083 	{"\033T",	F10, ctrl_mask},	/* F20 */
1084 	{"\033V",	F11, ctrl_mask},	/* F21 */
1085 	{"\033X",	F12, ctrl_mask},	/* F22 */
1086 	{"\033 ",	F1, shift_mask},	/* shift-F1 */
1087 	{"\033;",	F2, shift_mask},	/* shift-F2 */
1088 	{"\033\"",	F3, shift_mask},	/* shift-F3 */
1089 	{"\033#",	F4, shift_mask},	/* shift-F4 */
1090 	{"\033$",	F5, shift_mask},	/* shift-F5 */
1091 	{"\033%",	F6, shift_mask},	/* shift-F6 */
1092 	{"\033&",	F7, shift_mask},	/* shift-F7 */
1093 	{"\033'",	F8, shift_mask},	/* shift-F8 */
1094 	{"\033<",	F9, shift_mask},	/* shift-F9 */
1095 	{"\033=",	F10, shift_mask},	/* shift-F10 */
1096 	{"\033*",	F11, shift_mask},	/* shift-F11 */
1097 	{"\033+",	F12, shift_mask},	/* shift-F12 */
1098 	{"\033,",	F3, ctrlshift_mask},	/* control-shift-F13 */
1099 	{"\033-",	F4, ctrlshift_mask},	/* control-shift-F14 */
1100 	{"\033.",	F5, ctrlshift_mask},	/* control-shift-F15 */
1101 	{"\033/",	F6, ctrlshift_mask},	/* control-shift-F16 */
1102 	{"\0331",	F7, ctrlshift_mask},	/* control-shift-F17 */
1103 	{"\0332",	F8, ctrlshift_mask},	/* control-shift-F18 */
1104 	{"\0333",	F9, ctrlshift_mask},	/* control-shift-F19 */
1105 	{"\033U",	F10, ctrlshift_mask},	/* control-shift-F20 */
1106 	{"\033W",	F11, ctrlshift_mask},	/* control-shift-F21 */
1107 	{"\033Y",	F12, ctrlshift_mask},	/* control-shift-F22 */
1108 
1109 	{NIL_PTR}
1110 };
1111 
1112 #endif	/* #ifndef msdos */
1113 
1114 
1115 /*======================================================================*\
1116 |*				End					*|
1117 \*======================================================================*/
1118