xref: /freebsd/contrib/tcsh/ed.defns.c (revision 6b2c1e49da284f28ec7b52f7c031474087e37104)
1 /*
2  * ed.defns.c: Editor function definitions and initialization
3  */
4 /*-
5  * Copyright (c) 1980, 1991 The Regents of the University of California.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of the University nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  */
32 #include "sh.h"
33 #include "ed.h"
34 
35 static	void		ed_InitMetaBindings 	(void);
36 
37 PFCmd   CcFuncTbl[] = {		/* table of available commands */
38     e_unassigned,
39 /* no #define here -- this is a dummy to detect initing of the key map */
40     e_unassigned,
41 #define		F_UNASSIGNED	1
42     e_insert,
43 #define		F_INSERT	2
44     e_newline,
45 #define		F_NEWLINE	3
46     e_delprev,
47 #define		F_DELPREV	4
48     e_delnext,
49 #define		F_DELNEXT	5
50     e_toend,
51 #define		F_TOEND		6
52     e_tobeg,
53 #define		F_TOBEG		7
54     e_charback,
55 #define		F_CHARBACK	8
56     e_charfwd,
57 #define		F_CHARFWD	9
58     e_quote,
59 #define		F_QUOTE		10
60     e_startover,
61 #define		F_STARTOVER	11
62     e_redisp,
63 #define		F_REDISP	12
64     e_tty_int,
65 #define		F_TTY_INT	13
66     e_wordback,
67 #define		F_WORDBACK	14
68     e_wordfwd,
69 #define		F_WORDFWD	15
70     e_cleardisp,
71 #define		F_CLEARDISP	16
72     e_complete,
73 #define		F_COMPLETE	17
74     e_correct,
75 #define		F_CORRECT	18
76     e_up_hist,
77 #define		F_UP_HIST	19
78     e_down_hist,
79 #define		F_DOWN_HIST	20
80     e_up_search_hist,
81 #define		F_UP_SEARCH_HIST	21
82     e_down_search_hist,
83 #define		F_DOWN_SEARCH_HIST	22
84     e_helpme,
85 #define		F_HELPME	23
86     e_list_choices,
87 #define		F_LIST_CHOICES	24
88     e_delwordprev,
89 #define		F_DELWORDPREV	25
90     e_delwordnext,
91 #define		F_DELWORDNEXT	26
92     e_digit,
93 #define		F_DIGIT		27
94     e_killend,
95 #define		F_KILLEND	28
96     e_killbeg,
97 #define		F_KILLBEG	29
98     e_metanext,
99 #define		F_METANEXT	30
100     e_send_eof,
101 #define		F_SEND_EOF	31
102     e_charswitch,
103 #define		F_CHARSWITCH	32
104     e_which,
105 #define		F_WHICH		33
106     e_yank_kill,
107 #define		F_YANK_KILL	34
108     e_tty_dsusp,
109 #define		F_TTY_DSUSP	35
110     e_tty_flusho,
111 #define		F_TTY_FLUSHO	36
112     e_tty_quit,
113 #define		F_TTY_QUIT	37
114     e_tty_tsusp,
115 #define		F_TTY_TSUSP	38
116     e_tty_stopo,
117 #define		F_TTY_STOPO	39
118     e_tty_starto,
119 #define		F_TTY_STARTO	40
120     e_argfour,
121 #define		F_ARGFOUR	41
122     e_set_mark,
123 #define		F_SET_MARK	42
124     e_exchange_mark,
125 #define		F_EXCHANGE_MARK	43
126     e_last_item,
127 #define		F_LAST_ITEM	44
128     e_delnext_list_eof,
129 #define		F_DELNEXT_LIST_EOF	45
130     v_cmd_mode,
131 #define		V_CMD_MODE	46
132     v_insert,
133 #define		V_INSERT	47
134     e_argdigit,
135 #define		F_ARGDIGIT	48
136     e_killregion,
137 #define		F_KILLREGION	49
138     e_copyregion,
139 #define		F_COPYREGION	50
140     e_gcharswitch,
141 #define		F_GCHARSWITCH	51
142     e_run_fg_editor,
143 #define		F_RUN_FG_EDITOR	52
144     e_unassigned,	/* place holder for sequence lead in character */
145 #define		F_XKEY		53
146     e_uppercase,
147 #define         F_CASEUPPER     54
148     e_lowercase,
149 #define         F_CASELOWER     55
150     e_capitalcase,
151 #define         F_CASECAPITAL   56
152     v_zero,
153 #define		V_ZERO		57
154     v_add,
155 #define		V_ADD		58
156     v_addend,
157 #define		V_ADDEND	59
158     v_wordbegnext,
159 #define		V_WORDBEGNEXT	60
160     e_killall,
161 #define		F_KILLALL	61
162     e_unassigned,
163 /* F_EXTENDNEXT removed */
164     v_insbeg,
165 #define		V_INSBEG	63
166     v_replmode,
167 #define		V_REPLMODE	64
168     v_replone,
169 #define		V_REPLONE	65
170     v_substline,
171 #define		V_SUBSTLINE	66
172     v_substchar,
173 #define		V_SUBSTCHAR	67
174     v_chgtoend,
175 #define		V_CHGTOEND	68
176     e_list_eof,
177 #define		F_LIST_EOF	69
178     e_list_glob,
179 #define		F_LIST_GLOB	70
180     e_expand_history,
181 #define		F_EXPAND_HISTORY	71
182     e_magic_space,
183 #define		F_MAGIC_SPACE	72
184     e_insovr,
185 #define		F_INSOVR	73
186     v_cm_complete,
187 #define		V_CM_COMPLETE	74
188     e_copyprev,
189 #define		F_COPYPREV	75
190     e_correctl,
191 #define		F_CORRECT_L	76
192     e_expand_glob,
193 #define		F_EXPAND_GLOB	77
194     e_expand_vars,
195 #define		F_EXPAND_VARS	78
196     e_toggle_hist,
197 #define		F_TOGGLE_HIST	79
198     v_change_case,
199 #define		V_CHGCASE	80
200     e_expand,
201 #define		F_EXPAND	81
202     e_load_average,
203 #define		F_LOAD_AVERAGE	82
204     v_delprev,
205 #define		V_DELPREV	83
206     v_delmeta,
207 #define		V_DELMETA	84
208     v_wordfwd,
209 #define		V_WORDFWD	85
210     v_wordback,
211 #define		V_WORDBACK	86
212     v_endword,
213 #define		V_ENDWORD	87
214     v_eword,
215 #define		V_EWORD		88
216     v_undo,
217 #define		V_UNDO		89
218     v_ush_meta,
219 #define		V_USH_META	90
220     v_dsh_meta,
221 #define		V_DSH_META	91
222     v_rsrch_fwd,
223 #define		V_RSRCH_FWD	92
224     v_rsrch_back,
225 #define		V_RSRCH_BACK	93
226     v_char_fwd,
227 #define		V_CHAR_FWD	94
228     v_char_back,
229 #define		V_CHAR_BACK	95
230     v_chgmeta,
231 #define		V_CHGMETA	96
232     e_inc_fwd,
233 #define		F_INC_FWD	97
234     e_inc_back,
235 #define		F_INC_BACK	98
236     v_rchar_fwd,
237 #define		V_RCHAR_FWD	99
238     v_rchar_back,
239 #define		V_RCHAR_BACK	100
240     v_charto_fwd,
241 #define		V_CHARTO_FWD	101
242     v_charto_back,
243 #define		V_CHARTO_BACK	102
244     e_normalize_path,
245 #define		F_PATH_NORM	103
246     e_delnext_eof,		/* added by mtk@ari.ncl.omron.co.jp (920818) */
247 #define		F_DELNEXT_EOF	104
248     e_stuff_char,
249 #define		F_STUFF_CHAR	105
250     e_complete_all,
251 #define		F_COMPLETE_ALL	106
252     e_list_all,
253 #define		F_LIST_ALL	107
254     e_complete_fwd,
255 #define		F_COMPLETE_FWD	108
256     e_complete_back,
257 #define		F_COMPLETE_BACK	109
258     e_delnext_list,
259 #define		F_DELNEXT_LIST	110
260     e_normalize_command,
261 #define		F_COMMAND_NORM	111
262     e_dabbrev_expand,
263 #define		F_DABBREV_EXPAND	112
264     e_dosify_next,
265 #define		F_DOSIFY_NEXT	113
266     e_dosify_prev,
267 #define		F_DOSIFY_PREV	114
268     e_page_up,
269 #define		F_PAGE_UP	115
270     e_page_down,
271 #define		F_PAGE_DOWN	116
272     e_yank_pop,
273 #define		F_YANK_POP	117
274     e_newline_hold,
275 #define		F_NEWLINE_HOLD	118
276     e_newline_down_hist,
277 #define		F_NEWLINE_DOWN_HIST	119
278     0				/* DUMMY VALUE */
279 #define		F_NUM_FNS	120
280 
281 };
282 
283 KEYCMD  NumFuns = F_NUM_FNS;
284 
285 KEYCMD  CcKeyMap[NT_NUM_KEYS];		/* the real key map */
286 KEYCMD  CcAltMap[NT_NUM_KEYS];		/* the alternative key map */
287 #define	F_NUM_FUNCNAMES	(F_NUM_FNS + 2)
288 struct KeyFuncs FuncNames[F_NUM_FUNCNAMES];
289 
290 #ifdef WINNT_NATIVE
291 extern KEYCMD CcEmacsMap[];
292 extern KEYCMD CcViMap[];
293 extern KEYCMD  CcViCmdMap[];
294 #else /* !WINNT_NATIVE*/
295 KEYCMD  CcEmacsMap[] = {
296 /* keymap table, each index into above tbl; should be 256*sizeof(KEYCMD)
297    bytes long */
298 
299     F_SET_MARK,			/* ^@ */
300     F_TOBEG,			/* ^A */
301     F_CHARBACK,			/* ^B */
302     F_TTY_INT,			/* ^C */
303     F_DELNEXT_LIST_EOF,		/* ^D */
304     F_TOEND,			/* ^E */
305     F_CHARFWD,			/* ^F */
306     F_UNASSIGNED,		/* ^G */
307     F_DELPREV,			/* ^H */
308     F_COMPLETE,			/* ^I */
309     F_NEWLINE,			/* ^J */
310     F_KILLEND,			/* ^K */
311     F_CLEARDISP,		/* ^L */
312     F_NEWLINE,			/* ^M */
313     F_DOWN_HIST,		/* ^N */
314     F_TTY_FLUSHO,		/* ^O */
315     F_UP_HIST,			/* ^P */
316     F_TTY_STARTO,		/* ^Q */
317     F_REDISP,			/* ^R */
318     F_TTY_STOPO,		/* ^S */
319     F_CHARSWITCH,		/* ^T */
320     F_KILLALL,			/* ^U */
321     F_QUOTE,			/* ^V */
322     F_KILLREGION,		/* ^W */
323     F_XKEY,			/* ^X */
324     F_YANK_KILL,		/* ^Y */
325     F_TTY_TSUSP,		/* ^Z */
326     F_METANEXT,			/* ^[ */
327     F_TTY_QUIT,			/* ^\ */
328     F_TTY_DSUSP,		/* ^] */
329     F_UNASSIGNED,		/* ^^ */
330     F_UNASSIGNED,		/* ^_ */
331     F_INSERT,			/* SPACE */
332     F_INSERT,			/* ! */
333     F_INSERT,			/* " */
334     F_INSERT,			/* # */
335     F_INSERT,			/* $ */
336     F_INSERT,			/* % */
337     F_INSERT,			/* & */
338     F_INSERT,			/* ' */
339     F_INSERT,			/* ( */
340     F_INSERT,			/* ) */
341     F_INSERT,			/* * */
342     F_INSERT,			/* + */
343     F_INSERT,			/* , */
344     F_INSERT,			/* - */
345     F_INSERT,			/* . */
346     F_INSERT,			/* / */
347     F_DIGIT,			/* 0 */
348     F_DIGIT,			/* 1 */
349     F_DIGIT,			/* 2 */
350     F_DIGIT,			/* 3 */
351     F_DIGIT,			/* 4 */
352     F_DIGIT,			/* 5 */
353     F_DIGIT,			/* 6 */
354     F_DIGIT,			/* 7 */
355     F_DIGIT,			/* 8 */
356     F_DIGIT,			/* 9 */
357     F_INSERT,			/* : */
358     F_INSERT,			/* ; */
359     F_INSERT,			/* < */
360     F_INSERT,			/* = */
361     F_INSERT,			/* > */
362     F_INSERT,			/* ? */
363     F_INSERT,			/* @ */
364     F_INSERT,			/* A */
365     F_INSERT,			/* B */
366     F_INSERT,			/* C */
367     F_INSERT,			/* D */
368     F_INSERT,			/* E */
369     F_INSERT,			/* F */
370     F_INSERT,			/* G */
371     F_INSERT,			/* H */
372     F_INSERT,			/* I */
373     F_INSERT,			/* J */
374     F_INSERT,			/* K */
375     F_INSERT,			/* L */
376     F_INSERT,			/* M */
377     F_INSERT,			/* N */
378     F_INSERT,			/* O */
379     F_INSERT,			/* P */
380     F_INSERT,			/* Q */
381     F_INSERT,			/* R */
382     F_INSERT,			/* S */
383     F_INSERT,			/* T */
384     F_INSERT,			/* U */
385     F_INSERT,			/* V */
386     F_INSERT,			/* W */
387     F_INSERT,			/* X */
388     F_INSERT,			/* Y */
389     F_INSERT,			/* Z */
390     F_INSERT,			/* [ */
391     F_INSERT,			/* \ */
392     F_INSERT,			/* ] */
393     F_INSERT,			/* ^ */
394     F_INSERT,			/* _ */
395     F_INSERT,			/* ` */
396     F_INSERT,			/* a */
397     F_INSERT,			/* b */
398     F_INSERT,			/* c */
399     F_INSERT,			/* d */
400     F_INSERT,			/* e */
401     F_INSERT,			/* f */
402     F_INSERT,			/* g */
403     F_INSERT,			/* h */
404     F_INSERT,			/* i */
405     F_INSERT,			/* j */
406     F_INSERT,			/* k */
407     F_INSERT,			/* l */
408     F_INSERT,			/* m */
409     F_INSERT,			/* n */
410     F_INSERT,			/* o */
411     F_INSERT,			/* p */
412     F_INSERT,			/* q */
413     F_INSERT,			/* r */
414     F_INSERT,			/* s */
415     F_INSERT,			/* t */
416     F_INSERT,			/* u */
417     F_INSERT,			/* v */
418     F_INSERT,			/* w */
419     F_INSERT,			/* x */
420     F_INSERT,			/* y */
421     F_INSERT,			/* z */
422     F_INSERT,			/* { */
423     F_INSERT,			/* | */
424     F_INSERT,			/* } */
425     F_INSERT,			/* ~ */
426     F_DELPREV,			/* ^? */
427     F_UNASSIGNED,		/* M-^@ */
428     F_UNASSIGNED,		/* M-^A */
429     F_UNASSIGNED,		/* M-^B */
430     F_UNASSIGNED,		/* M-^C */
431     F_LIST_CHOICES,		/* M-^D */
432     F_UNASSIGNED,		/* M-^E */
433     F_UNASSIGNED,		/* M-^F */
434     F_UNASSIGNED,		/* M-^G */
435     F_DELWORDPREV,		/* M-^H */
436     F_COMPLETE,			/* M-^I */
437     F_UNASSIGNED,		/* M-^J */
438     F_UNASSIGNED,		/* M-^K */
439     F_CLEARDISP,		/* M-^L */
440     F_UNASSIGNED,		/* M-^M */
441     F_UNASSIGNED,		/* M-^N */
442     F_UNASSIGNED,		/* M-^O */
443     F_UNASSIGNED,		/* M-^P */
444     F_UNASSIGNED,		/* M-^Q */
445     F_UNASSIGNED,		/* M-^R */
446     F_UNASSIGNED,		/* M-^S */
447     F_UNASSIGNED,		/* M-^T */
448     F_UNASSIGNED,		/* M-^U */
449     F_UNASSIGNED,		/* M-^V */
450     F_UNASSIGNED,		/* M-^W */
451     F_UNASSIGNED,		/* M-^X */
452     F_UNASSIGNED,		/* M-^Y */
453     F_RUN_FG_EDITOR,		/* M-^Z */
454     F_COMPLETE,			/* M-^[ */
455     F_UNASSIGNED,		/* M-^\ */
456     F_UNASSIGNED,		/* M-^] */
457     F_UNASSIGNED,		/* M-^^ */
458     F_COPYPREV,			/* M-^_ */
459     F_EXPAND_HISTORY,		/* M-SPACE */
460     F_EXPAND_HISTORY,		/* M-! */
461     F_UNASSIGNED,		/* M-" */
462     F_UNASSIGNED,		/* M-# */
463     F_CORRECT_L,		/* M-$ */
464     F_UNASSIGNED,		/* M-% */
465     F_UNASSIGNED,		/* M-& */
466     F_UNASSIGNED,		/* M-' */
467     F_UNASSIGNED,		/* M-( */
468     F_UNASSIGNED,		/* M-) */
469     F_UNASSIGNED,		/* M-* */
470     F_UNASSIGNED,		/* M-+ */
471     F_UNASSIGNED,		/* M-, */
472     F_UNASSIGNED,		/* M-- */
473     F_UNASSIGNED,		/* M-. */
474     F_DABBREV_EXPAND,		/* M-/ */
475     F_ARGDIGIT,			/* M-0 */
476     F_ARGDIGIT,			/* M-1 */
477     F_ARGDIGIT,			/* M-2 */
478     F_ARGDIGIT,			/* M-3 */
479     F_ARGDIGIT,			/* M-4 */
480     F_ARGDIGIT,			/* M-5 */
481     F_ARGDIGIT,			/* M-6 */
482     F_ARGDIGIT,			/* M-7 */
483     F_ARGDIGIT,			/* M-8 */
484     F_ARGDIGIT,			/* M-9 */
485     F_UNASSIGNED,		/* M-: */
486     F_UNASSIGNED,		/* M-; */
487     F_UNASSIGNED,		/* M-< */
488     F_UNASSIGNED,		/* M-= */
489     F_UNASSIGNED,		/* M-> */
490     F_WHICH,			/* M-? */
491     F_UNASSIGNED,		/* M-@ */
492     F_NEWLINE_HOLD,		/* M-A */
493     F_WORDBACK,			/* M-B */
494     F_CASECAPITAL,		/* M-C */
495     F_DELWORDNEXT,		/* M-D */
496     F_UNASSIGNED,		/* M-E */
497     F_WORDFWD,			/* M-F */
498     F_UNASSIGNED,		/* M-G */
499     F_HELPME,			/* M-H */
500     F_UNASSIGNED,		/* M-I */
501     F_UNASSIGNED,		/* M-J */
502     F_UNASSIGNED,		/* M-K */
503     F_CASELOWER,		/* M-L */
504     F_UNASSIGNED,		/* M-M */
505     F_DOWN_SEARCH_HIST,		/* M-N */
506     F_XKEY,			/* M-O *//* extended key esc PWP Mar 88 */
507     F_UP_SEARCH_HIST,		/* M-P */
508     F_UNASSIGNED,		/* M-Q */
509     F_TOGGLE_HIST,		/* M-R */
510     F_CORRECT,			/* M-S */
511     F_UNASSIGNED,		/* M-T */
512     F_CASEUPPER,		/* M-U */
513     F_UNASSIGNED,		/* M-V */
514     F_COPYREGION,		/* M-W */
515     F_UNASSIGNED,		/* M-X */
516     F_YANK_POP,			/* M-Y */
517     F_UNASSIGNED,		/* M-Z */
518     F_XKEY,			/* M-[ *//* extended key esc -mf Oct 87 */
519     F_UNASSIGNED,		/* M-\ */
520     F_UNASSIGNED,		/* M-] */
521     F_UNASSIGNED,		/* M-^ */
522     F_LAST_ITEM,		/* M-_ */
523     F_UNASSIGNED,		/* M-` */
524     F_NEWLINE_HOLD,		/* M-a */
525     F_WORDBACK,			/* M-b */
526     F_CASECAPITAL,		/* M-c */
527     F_DELWORDNEXT,		/* M-d */
528     F_UNASSIGNED,		/* M-e */
529     F_WORDFWD,			/* M-f */
530     F_UNASSIGNED,		/* M-g */
531     F_HELPME,			/* M-h */
532     F_UNASSIGNED,		/* M-i */
533     F_UNASSIGNED,		/* M-j */
534     F_UNASSIGNED,		/* M-k */
535     F_CASELOWER,		/* M-l */
536     F_UNASSIGNED,		/* M-m */
537     F_DOWN_SEARCH_HIST,		/* M-n */
538     F_UNASSIGNED,		/* M-o */
539     F_UP_SEARCH_HIST,		/* M-p */
540     F_UNASSIGNED,		/* M-q */
541     F_TOGGLE_HIST,		/* M-r */
542     F_CORRECT,			/* M-s */
543     F_UNASSIGNED,		/* M-t */
544     F_CASEUPPER,		/* M-u */
545     F_UNASSIGNED,		/* M-v */
546     F_COPYREGION,		/* M-w */
547     F_UNASSIGNED,		/* M-x */
548     F_YANK_POP,			/* M-y */
549     F_UNASSIGNED,		/* M-z */
550     F_UNASSIGNED,		/* M-{ */
551     F_UNASSIGNED,		/* M-| */
552     F_UNASSIGNED,		/* M-} */
553     F_UNASSIGNED,		/* M-~ */
554     F_DELWORDPREV		/* M-^? */
555 };
556 
557 /*
558  * keymap table for vi.  Each index into above tbl; should be
559  * 256 entries long.  Vi mode uses a sticky-extend to do command mode:
560  * insert mode characters are in the normal keymap, and command mode
561  * in the extended keymap.
562  */
563 static KEYCMD  CcViMap[] = {
564 #ifdef KSHVI
565     F_UNASSIGNED,		/* ^@ */
566     F_INSERT,			/* ^A */
567     F_INSERT,			/* ^B */
568     F_INSERT,			/* ^C */
569     F_INSERT,			/* ^D */
570     F_INSERT,			/* ^E */
571     F_INSERT,			/* ^F */
572     F_INSERT,			/* ^G */
573     V_DELPREV,			/* ^H */   /* BackSpace key */
574     F_COMPLETE,			/* ^I */   /* Tab Key  */
575     F_NEWLINE,			/* ^J */
576     F_INSERT,			/* ^K */
577     F_INSERT,			/* ^L */
578     F_NEWLINE,			/* ^M */
579     F_INSERT,			/* ^N */
580     F_INSERT,			/* ^O */
581     F_INSERT,			/* ^P */
582     F_TTY_STARTO,		/* ^Q */
583     F_INSERT,			/* ^R */
584     F_INSERT,			/* ^S */
585     F_INSERT,			/* ^T */
586     F_INSERT,			/* ^U */
587     F_QUOTE,			/* ^V */
588     F_DELWORDPREV,		/* ^W */  /* Only until start edit pos */
589     F_INSERT,			/* ^X */
590     F_INSERT,			/* ^Y */
591     F_INSERT,			/* ^Z */
592     V_CMD_MODE,			/* ^[ */  /* [ Esc ] key */
593     F_TTY_QUIT,			/* ^\ */
594     F_INSERT,			/* ^] */
595     F_INSERT,			/* ^^ */
596     F_INSERT,			/* ^_ */
597 #else /* !KSHVI */
598     F_UNASSIGNED,		/* ^@ */   /* NOTE: These mapping do NOT */
599     F_TOBEG,			/* ^A */   /* Correspond well to the KSH */
600     F_CHARBACK,			/* ^B */   /* VI editting assignments    */
601     F_TTY_INT,			/* ^C */   /* On the other hand they are */
602     F_LIST_EOF,			/* ^D */   /* convenient any many people */
603     F_TOEND,			/* ^E */   /* have gotten used to them   */
604     F_CHARFWD,			/* ^F */
605     F_LIST_GLOB,		/* ^G */
606     F_DELPREV,			/* ^H */   /* BackSpace key */
607     F_COMPLETE,			/* ^I */   /* Tab Key */
608     F_NEWLINE,			/* ^J */
609     F_KILLEND,			/* ^K */
610     F_CLEARDISP,		/* ^L */
611     F_NEWLINE,			/* ^M */
612     F_DOWN_HIST,		/* ^N */
613     F_TTY_FLUSHO,		/* ^O */
614     F_UP_HIST,			/* ^P */
615     F_TTY_STARTO,		/* ^Q */
616     F_REDISP,			/* ^R */
617     F_TTY_STOPO,		/* ^S */
618     F_CHARSWITCH,		/* ^T */
619     F_KILLBEG,			/* ^U */
620     F_QUOTE,			/* ^V */
621     F_DELWORDPREV,		/* ^W */
622     F_EXPAND,			/* ^X */
623     F_TTY_DSUSP,		/* ^Y */
624     F_TTY_TSUSP,		/* ^Z */
625     V_CMD_MODE,			/* ^[ */
626     F_TTY_QUIT,			/* ^\ */
627     F_UNASSIGNED,		/* ^] */
628     F_UNASSIGNED,		/* ^^ */
629     F_UNASSIGNED,		/* ^_ */
630 #endif  /* KSHVI */
631     F_INSERT,			/* SPACE */
632     F_INSERT,			/* ! */
633     F_INSERT,			/* " */
634     F_INSERT,			/* # */
635     F_INSERT,			/* $ */
636     F_INSERT,			/* % */
637     F_INSERT,			/* & */
638     F_INSERT,			/* ' */
639     F_INSERT,			/* ( */
640     F_INSERT,			/* ) */
641     F_INSERT,			/* * */
642     F_INSERT,			/* + */
643     F_INSERT,			/* , */
644     F_INSERT,			/* - */
645     F_INSERT,			/* . */
646     F_INSERT,			/* / */
647     F_INSERT,			/* 0 */
648     F_INSERT,			/* 1 */
649     F_INSERT,			/* 2 */
650     F_INSERT,			/* 3 */
651     F_INSERT,			/* 4 */
652     F_INSERT,			/* 5 */
653     F_INSERT,			/* 6 */
654     F_INSERT,			/* 7 */
655     F_INSERT,			/* 8 */
656     F_INSERT,			/* 9 */
657     F_INSERT,			/* : */
658     F_INSERT,			/* ; */
659     F_INSERT,			/* < */
660     F_INSERT,			/* = */
661     F_INSERT,			/* > */
662     F_INSERT,			/* ? */
663     F_INSERT,			/* @ */
664     F_INSERT,			/* A */
665     F_INSERT,			/* B */
666     F_INSERT,			/* C */
667     F_INSERT,			/* D */
668     F_INSERT,			/* E */
669     F_INSERT,			/* F */
670     F_INSERT,			/* G */
671     F_INSERT,			/* H */
672     F_INSERT,			/* I */
673     F_INSERT,			/* J */
674     F_INSERT,			/* K */
675     F_INSERT,			/* L */
676     F_INSERT,			/* M */
677     F_INSERT,			/* N */
678     F_INSERT,			/* O */
679     F_INSERT,			/* P */
680     F_INSERT,			/* Q */
681     F_INSERT,			/* R */
682     F_INSERT,			/* S */
683     F_INSERT,			/* T */
684     F_INSERT,			/* U */
685     F_INSERT,			/* V */
686     F_INSERT,			/* W */
687     F_INSERT,			/* X */
688     F_INSERT,			/* Y */
689     F_INSERT,			/* Z */
690     F_INSERT,			/* [ */
691     F_INSERT,			/* \ */
692     F_INSERT,			/* ] */
693     F_INSERT,			/* ^ */
694     F_INSERT,			/* _ */
695     F_INSERT,			/* ` */
696     F_INSERT,			/* a */
697     F_INSERT,			/* b */
698     F_INSERT,			/* c */
699     F_INSERT,			/* d */
700     F_INSERT,			/* e */
701     F_INSERT,			/* f */
702     F_INSERT,			/* g */
703     F_INSERT,			/* h */
704     F_INSERT,			/* i */
705     F_INSERT,			/* j */
706     F_INSERT,			/* k */
707     F_INSERT,			/* l */
708     F_INSERT,			/* m */
709     F_INSERT,			/* n */
710     F_INSERT,			/* o */
711     F_INSERT,			/* p */
712     F_INSERT,			/* q */
713     F_INSERT,			/* r */
714     F_INSERT,			/* s */
715     F_INSERT,			/* t */
716     F_INSERT,			/* u */
717     F_INSERT,			/* v */
718     F_INSERT,			/* w */
719     F_INSERT,			/* x */
720     F_INSERT,			/* y */
721     F_INSERT,			/* z */
722     F_INSERT,			/* { */
723     F_INSERT,			/* | */
724     F_INSERT,			/* } */
725     F_INSERT,			/* ~ */
726     F_DELPREV,			/* ^? */
727     F_UNASSIGNED,		/* M-^@ */
728     F_UNASSIGNED,		/* M-^A */
729     F_UNASSIGNED,		/* M-^B */
730     F_UNASSIGNED,		/* M-^C */
731     F_UNASSIGNED,		/* M-^D */
732     F_UNASSIGNED,		/* M-^E */
733     F_UNASSIGNED,		/* M-^F */
734     F_UNASSIGNED,		/* M-^G */
735     F_UNASSIGNED,		/* M-^H */
736     F_UNASSIGNED,		/* M-^I */
737     F_UNASSIGNED,		/* M-^J */
738     F_UNASSIGNED,		/* M-^K */
739     F_UNASSIGNED,		/* M-^L */
740     F_UNASSIGNED,		/* M-^M */
741     F_UNASSIGNED,		/* M-^N */
742     F_UNASSIGNED,		/* M-^O */
743     F_UNASSIGNED,		/* M-^P */
744     F_UNASSIGNED,		/* M-^Q */
745     F_UNASSIGNED,		/* M-^R */
746     F_UNASSIGNED,		/* M-^S */
747     F_UNASSIGNED,		/* M-^T */
748     F_UNASSIGNED,		/* M-^U */
749     F_UNASSIGNED,		/* M-^V */
750     F_UNASSIGNED,		/* M-^W */
751     F_UNASSIGNED,		/* M-^X */
752     F_UNASSIGNED,		/* M-^Y */
753     F_UNASSIGNED,		/* M-^Z */
754     F_UNASSIGNED,		/* M-^[ */
755     F_UNASSIGNED,		/* M-^\ */
756     F_UNASSIGNED,		/* M-^] */
757     F_UNASSIGNED,		/* M-^^ */
758     F_UNASSIGNED,		/* M-^_ */
759     F_UNASSIGNED,		/* M-SPACE */
760     F_UNASSIGNED,		/* M-! */
761     F_UNASSIGNED,		/* M-" */
762     F_UNASSIGNED,		/* M-# */
763     F_UNASSIGNED,		/* M-$ */
764     F_UNASSIGNED,		/* M-% */
765     F_UNASSIGNED,		/* M-& */
766     F_UNASSIGNED,		/* M-' */
767     F_UNASSIGNED,		/* M-( */
768     F_UNASSIGNED,		/* M-) */
769     F_UNASSIGNED,		/* M-* */
770     F_UNASSIGNED,		/* M-+ */
771     F_UNASSIGNED,		/* M-, */
772     F_UNASSIGNED,		/* M-- */
773     F_UNASSIGNED,		/* M-. */
774     F_UNASSIGNED,		/* M-/ */
775     F_UNASSIGNED,		/* M-0 */
776     F_UNASSIGNED,		/* M-1 */
777     F_UNASSIGNED,		/* M-2 */
778     F_UNASSIGNED,		/* M-3 */
779     F_UNASSIGNED,		/* M-4 */
780     F_UNASSIGNED,		/* M-5 */
781     F_UNASSIGNED,		/* M-6 */
782     F_UNASSIGNED,		/* M-7 */
783     F_UNASSIGNED,		/* M-8 */
784     F_UNASSIGNED,		/* M-9 */
785     F_UNASSIGNED,		/* M-: */
786     F_UNASSIGNED,		/* M-; */
787     F_UNASSIGNED,		/* M-< */
788     F_UNASSIGNED,		/* M-= */
789     F_UNASSIGNED,		/* M-> */
790     F_UNASSIGNED,		/* M-? */
791     F_UNASSIGNED,		/* M-@ */
792     F_UNASSIGNED,		/* M-A */
793     F_UNASSIGNED,		/* M-B */
794     F_UNASSIGNED,		/* M-C */
795     F_UNASSIGNED,		/* M-D */
796     F_UNASSIGNED,		/* M-E */
797     F_UNASSIGNED,		/* M-F */
798     F_UNASSIGNED,		/* M-G */
799     F_UNASSIGNED,		/* M-H */
800     F_UNASSIGNED,		/* M-I */
801     F_UNASSIGNED,		/* M-J */
802     F_UNASSIGNED,		/* M-K */
803     F_UNASSIGNED,		/* M-L */
804     F_UNASSIGNED,		/* M-M */
805     F_UNASSIGNED,		/* M-N */
806     F_UNASSIGNED,		/* M-O */
807     F_UNASSIGNED,		/* M-P */
808     F_UNASSIGNED,		/* M-Q */
809     F_UNASSIGNED,		/* M-R */
810     F_UNASSIGNED,		/* M-S */
811     F_UNASSIGNED,		/* M-T */
812     F_UNASSIGNED,		/* M-U */
813     F_UNASSIGNED,		/* M-V */
814     F_UNASSIGNED,		/* M-W */
815     F_UNASSIGNED,		/* M-X */
816     F_UNASSIGNED,		/* M-Y */
817     F_UNASSIGNED,		/* M-Z */
818     F_UNASSIGNED,		/* M-[ */
819     F_UNASSIGNED,		/* M-\ */
820     F_UNASSIGNED,		/* M-] */
821     F_UNASSIGNED,		/* M-^ */
822     F_UNASSIGNED,		/* M-_ */
823     F_UNASSIGNED,		/* M-` */
824     F_UNASSIGNED,		/* M-a */
825     F_UNASSIGNED,		/* M-b */
826     F_UNASSIGNED,		/* M-c */
827     F_UNASSIGNED,		/* M-d */
828     F_UNASSIGNED,		/* M-e */
829     F_UNASSIGNED,		/* M-f */
830     F_UNASSIGNED,		/* M-g */
831     F_UNASSIGNED,		/* M-h */
832     F_UNASSIGNED,		/* M-i */
833     F_UNASSIGNED,		/* M-j */
834     F_UNASSIGNED,		/* M-k */
835     F_UNASSIGNED,		/* M-l */
836     F_UNASSIGNED,		/* M-m */
837     F_UNASSIGNED,		/* M-n */
838     F_UNASSIGNED,		/* M-o */
839     F_UNASSIGNED,		/* M-p */
840     F_UNASSIGNED,		/* M-q */
841     F_UNASSIGNED,		/* M-r */
842     F_UNASSIGNED,		/* M-s */
843     F_UNASSIGNED,		/* M-t */
844     F_UNASSIGNED,		/* M-u */
845     F_UNASSIGNED,		/* M-v */
846     F_UNASSIGNED,		/* M-w */
847     F_UNASSIGNED,		/* M-x */
848     F_UNASSIGNED,		/* M-y */
849     F_UNASSIGNED,		/* M-z */
850     F_UNASSIGNED,		/* M-{ */
851     F_UNASSIGNED,		/* M-| */
852     F_UNASSIGNED,		/* M-} */
853     F_UNASSIGNED,		/* M-~ */
854     F_UNASSIGNED		/* M-^? */
855 };
856 
857 KEYCMD  CcViCmdMap[] = {
858     F_UNASSIGNED,		/* ^@ */
859     F_TOBEG,			/* ^A */
860     F_UNASSIGNED,		/* ^B */
861     F_TTY_INT,			/* ^C */
862     F_LIST_CHOICES,		/* ^D */
863     F_TOEND,			/* ^E */
864     F_UNASSIGNED,		/* ^F */
865     F_LIST_GLOB,		/* ^G */
866     F_CHARBACK,			/* ^H */
867     V_CM_COMPLETE,		/* ^I */
868     F_NEWLINE,			/* ^J */
869     F_KILLEND,			/* ^K */
870     F_CLEARDISP,		/* ^L */
871     F_NEWLINE,			/* ^M */
872     F_DOWN_HIST,		/* ^N */
873     F_TTY_FLUSHO,		/* ^O */
874     F_UP_HIST,			/* ^P */
875     F_TTY_STARTO,		/* ^Q */
876     F_REDISP,			/* ^R */
877     F_TTY_STOPO,		/* ^S */
878     F_UNASSIGNED,		/* ^T */
879     F_KILLBEG,			/* ^U */
880     F_UNASSIGNED,		/* ^V */
881     F_DELWORDPREV,		/* ^W */
882     F_EXPAND,			/* ^X */
883     F_UNASSIGNED,		/* ^Y */
884     F_UNASSIGNED,		/* ^Z */
885     F_METANEXT,			/* ^[ */
886     F_TTY_QUIT,			/* ^\ */
887     F_UNASSIGNED,		/* ^] */
888     F_UNASSIGNED,		/* ^^ */
889     F_UNASSIGNED,		/* ^_ */
890     F_CHARFWD,			/* SPACE */
891     F_EXPAND_HISTORY,		/* ! */
892     F_UNASSIGNED,		/* " */
893     F_UNASSIGNED,		/* # */
894     F_TOEND,			/* $ */
895     F_UNASSIGNED,		/* % */
896     F_UNASSIGNED,		/* & */
897     F_UNASSIGNED,		/* ' */
898     F_UNASSIGNED,		/* ( */
899     F_UNASSIGNED,		/* ) */
900     F_EXPAND_GLOB,		/* * */
901     F_DOWN_HIST,		/* + */
902     V_RCHAR_BACK,		/* , */
903     F_UP_HIST,			/* - */
904     F_UNASSIGNED,		/* . */
905     V_DSH_META,			/* / */
906     V_ZERO,			/* 0 */
907     F_ARGDIGIT,			/* 1 */
908     F_ARGDIGIT,			/* 2 */
909     F_ARGDIGIT,			/* 3 */
910     F_ARGDIGIT,			/* 4 */
911     F_ARGDIGIT,			/* 5 */
912     F_ARGDIGIT,			/* 6 */
913     F_ARGDIGIT,			/* 7 */
914     F_ARGDIGIT,			/* 8 */
915     F_ARGDIGIT,			/* 9 */
916     F_UNASSIGNED,		/* : */
917     V_RCHAR_FWD,		/* ; */
918     F_UNASSIGNED,		/* < */
919     F_UNASSIGNED,		/* = */
920     F_UNASSIGNED,		/* > */
921     V_USH_META,			/* ? */
922     F_UNASSIGNED,		/* @ */
923     V_ADDEND,			/* A */
924     V_WORDBACK,			/* B */
925     V_CHGTOEND,			/* C */
926     F_KILLEND,			/* D */
927     V_ENDWORD,			/* E */
928     V_CHAR_BACK,		/* F */
929     F_UNASSIGNED,		/* G */
930     F_UNASSIGNED,		/* H */
931     V_INSBEG,			/* I */
932     F_DOWN_SEARCH_HIST,		/* J */
933     F_UP_SEARCH_HIST,		/* K */
934     F_UNASSIGNED,		/* L */
935     F_UNASSIGNED,		/* M */
936     V_RSRCH_BACK,		/* N */
937     F_XKEY,			/* O */
938     F_UNASSIGNED,		/* P */
939     F_UNASSIGNED,		/* Q */
940     V_REPLMODE,			/* R */
941     V_SUBSTLINE,		/* S */
942     V_CHARTO_BACK,		/* T */
943     F_UNASSIGNED,		/* U */
944     F_EXPAND_VARS,		/* V */
945     V_WORDFWD,			/* W */
946     F_DELPREV,			/* X */
947     F_UNASSIGNED,		/* Y */
948     F_UNASSIGNED,		/* Z */
949     F_XKEY,			/* [ */
950     F_UNASSIGNED,		/* \ */
951     F_UNASSIGNED,		/* ] */
952     F_TOBEG,			/* ^ */
953     F_UNASSIGNED,		/* _ */
954     F_UNASSIGNED,		/* ` */
955     V_ADD,			/* a */
956     F_WORDBACK,			/* b */
957     V_CHGMETA,			/* c */
958     V_DELMETA,			/* d */
959     V_EWORD,			/* e */
960     V_CHAR_FWD,			/* f */
961     F_UNASSIGNED,		/* g */
962     F_CHARBACK,			/* h */
963     V_INSERT,			/* i */
964     F_DOWN_HIST,		/* j */
965     F_UP_HIST,			/* k */
966     F_CHARFWD,			/* l */
967     F_UNASSIGNED,		/* m */
968     V_RSRCH_FWD,		/* n */
969     F_UNASSIGNED,		/* o */
970     F_UNASSIGNED,		/* p */
971     F_UNASSIGNED,		/* q */
972     V_REPLONE,			/* r */
973     V_SUBSTCHAR,		/* s */
974     V_CHARTO_FWD,		/* t */
975     V_UNDO,			/* u */
976     F_EXPAND_VARS,		/* v */
977     V_WORDBEGNEXT,		/* w */
978     F_DELNEXT_EOF,		/* x */
979     F_UNASSIGNED,		/* y */
980     F_UNASSIGNED,		/* z */
981     F_UNASSIGNED,		/* { */
982     F_UNASSIGNED,		/* | */
983     F_UNASSIGNED,		/* } */
984     V_CHGCASE,			/* ~ */
985     F_DELPREV,			/* ^? */
986     F_UNASSIGNED,		/* M-^@ */
987     F_UNASSIGNED,		/* M-^A */
988     F_UNASSIGNED,		/* M-^B */
989     F_UNASSIGNED,		/* M-^C */
990     F_UNASSIGNED,		/* M-^D */
991     F_UNASSIGNED,		/* M-^E */
992     F_UNASSIGNED,		/* M-^F */
993     F_UNASSIGNED,		/* M-^G */
994     F_UNASSIGNED,		/* M-^H */
995     F_UNASSIGNED,		/* M-^I */
996     F_UNASSIGNED,		/* M-^J */
997     F_UNASSIGNED,		/* M-^K */
998     F_UNASSIGNED,		/* M-^L */
999     F_UNASSIGNED,		/* M-^M */
1000     F_UNASSIGNED,		/* M-^N */
1001     F_UNASSIGNED,		/* M-^O */
1002     F_UNASSIGNED,		/* M-^P */
1003     F_UNASSIGNED,		/* M-^Q */
1004     F_UNASSIGNED,		/* M-^R */
1005     F_UNASSIGNED,		/* M-^S */
1006     F_UNASSIGNED,		/* M-^T */
1007     F_UNASSIGNED,		/* M-^U */
1008     F_UNASSIGNED,		/* M-^V */
1009     F_UNASSIGNED,		/* M-^W */
1010     F_UNASSIGNED,		/* M-^X */
1011     F_UNASSIGNED,		/* M-^Y */
1012     F_UNASSIGNED,		/* M-^Z */
1013     F_UNASSIGNED,		/* M-^[ */
1014     F_UNASSIGNED,		/* M-^\ */
1015     F_UNASSIGNED,		/* M-^] */
1016     F_UNASSIGNED,		/* M-^^ */
1017     F_UNASSIGNED,		/* M-^_ */
1018     F_UNASSIGNED,		/* M-SPACE */
1019     F_UNASSIGNED,		/* M-! */
1020     F_UNASSIGNED,		/* M-" */
1021     F_UNASSIGNED,		/* M-# */
1022     F_UNASSIGNED,		/* M-$ */
1023     F_UNASSIGNED,		/* M-% */
1024     F_UNASSIGNED,		/* M-& */
1025     F_UNASSIGNED,		/* M-' */
1026     F_UNASSIGNED,		/* M-( */
1027     F_UNASSIGNED,		/* M-) */
1028     F_UNASSIGNED,		/* M-* */
1029     F_UNASSIGNED,		/* M-+ */
1030     F_UNASSIGNED,		/* M-, */
1031     F_UNASSIGNED,		/* M-- */
1032     F_UNASSIGNED,		/* M-. */
1033     F_UNASSIGNED,		/* M-/ */
1034     F_UNASSIGNED,		/* M-0 */
1035     F_UNASSIGNED,		/* M-1 */
1036     F_UNASSIGNED,		/* M-2 */
1037     F_UNASSIGNED,		/* M-3 */
1038     F_UNASSIGNED,		/* M-4 */
1039     F_UNASSIGNED,		/* M-5 */
1040     F_UNASSIGNED,		/* M-6 */
1041     F_UNASSIGNED,		/* M-7 */
1042     F_UNASSIGNED,		/* M-8 */
1043     F_UNASSIGNED,		/* M-9 */
1044     F_UNASSIGNED,		/* M-: */
1045     F_UNASSIGNED,		/* M-; */
1046     F_UNASSIGNED,		/* M-< */
1047     F_UNASSIGNED,		/* M-= */
1048     F_UNASSIGNED,		/* M-> */
1049     F_HELPME,			/* M-? */
1050     F_UNASSIGNED,		/* M-@ */
1051     F_UNASSIGNED,		/* M-A */
1052     F_UNASSIGNED,		/* M-B */
1053     F_UNASSIGNED,		/* M-C */
1054     F_UNASSIGNED,		/* M-D */
1055     F_UNASSIGNED,		/* M-E */
1056     F_UNASSIGNED,		/* M-F */
1057     F_UNASSIGNED,		/* M-G */
1058     F_UNASSIGNED,		/* M-H */
1059     F_UNASSIGNED,		/* M-I */
1060     F_UNASSIGNED,		/* M-J */
1061     F_UNASSIGNED,		/* M-K */
1062     F_UNASSIGNED,		/* M-L */
1063     F_UNASSIGNED,		/* M-M */
1064     F_UNASSIGNED,		/* M-N */
1065     F_XKEY,			/* M-O *//* extended key esc PWP Mar 88 */
1066     F_UNASSIGNED,		/* M-P */
1067     F_UNASSIGNED,		/* M-Q */
1068     F_UNASSIGNED,		/* M-R */
1069     F_UNASSIGNED,		/* M-S */
1070     F_UNASSIGNED,		/* M-T */
1071     F_UNASSIGNED,		/* M-U */
1072     F_UNASSIGNED,		/* M-V */
1073     F_UNASSIGNED,		/* M-W */
1074     F_UNASSIGNED,		/* M-X */
1075     F_UNASSIGNED,		/* M-Y */
1076     F_UNASSIGNED,		/* M-Z */
1077     F_XKEY,			/* M-[ *//* extended key esc -mf Oct 87 */
1078     F_UNASSIGNED,		/* M-\ */
1079     F_UNASSIGNED,		/* M-] */
1080     F_UNASSIGNED,		/* M-^ */
1081     F_UNASSIGNED,		/* M-_ */
1082     F_UNASSIGNED,		/* M-` */
1083     F_UNASSIGNED,		/* M-a */
1084     F_UNASSIGNED,		/* M-b */
1085     F_UNASSIGNED,		/* M-c */
1086     F_UNASSIGNED,		/* M-d */
1087     F_UNASSIGNED,		/* M-e */
1088     F_UNASSIGNED,		/* M-f */
1089     F_UNASSIGNED,		/* M-g */
1090     F_UNASSIGNED,		/* M-h */
1091     F_UNASSIGNED,		/* M-i */
1092     F_UNASSIGNED,		/* M-j */
1093     F_UNASSIGNED,		/* M-k */
1094     F_UNASSIGNED,		/* M-l */
1095     F_UNASSIGNED,		/* M-m */
1096     F_UNASSIGNED,		/* M-n */
1097     F_UNASSIGNED,		/* M-o */
1098     F_UNASSIGNED,		/* M-p */
1099     F_UNASSIGNED,		/* M-q */
1100     F_UNASSIGNED,		/* M-r */
1101     F_UNASSIGNED,		/* M-s */
1102     F_UNASSIGNED,		/* M-t */
1103     F_UNASSIGNED,		/* M-u */
1104     F_UNASSIGNED,		/* M-v */
1105     F_UNASSIGNED,		/* M-w */
1106     F_UNASSIGNED,		/* M-x */
1107     F_UNASSIGNED,		/* M-y */
1108     F_UNASSIGNED,		/* M-z */
1109     F_UNASSIGNED,		/* M-{ */
1110     F_UNASSIGNED,		/* M-| */
1111     F_UNASSIGNED,		/* M-} */
1112     F_UNASSIGNED,		/* M-~ */
1113     F_UNASSIGNED		/* M-^? */
1114 };
1115 #endif /* WINNT_NATIVE */
1116 
1117 
1118 void
1119 editinit(void)
1120 {
1121     struct KeyFuncs *f;
1122 
1123 #if defined(NLS_CATALOGS) || defined(WINNT_NATIVE)
1124     int i;
1125 
1126     for (i = 0; i < F_NUM_FUNCNAMES; i++)
1127 	xfree((ptr_t)(intptr_t)FuncNames[i].desc);
1128 #endif
1129 
1130     f = FuncNames;
1131     f->name = "backward-char";
1132     f->func = F_CHARBACK;
1133     f->desc = CSAVS(3, 1, "Move back a character");
1134 
1135     f++;
1136     f->name = "backward-delete-char";
1137     f->func = F_DELPREV;
1138     f->desc = CSAVS(3, 2, "Delete the character behind cursor");
1139 
1140     f++;
1141     f->name = "backward-delete-word";
1142     f->func = F_DELWORDPREV;
1143     f->desc = CSAVS(3, 3,
1144 	"Cut from beginning of current word to cursor - saved in cut buffer");
1145 
1146     f++;
1147     f->name = "backward-kill-line";
1148     f->func = F_KILLBEG;
1149     f->desc = CSAVS(3, 4,
1150 	"Cut from beginning of line to cursor - save in cut buffer");
1151 
1152     f++;
1153     f->name = "backward-word";
1154     f->func = F_WORDBACK;
1155     f->desc = CSAVS(3, 5, "Move to beginning of current word");
1156 
1157     f++;
1158     f->name = "beginning-of-line";
1159     f->func = F_TOBEG;
1160     f->desc = CSAVS(3, 6, "Move to beginning of line");
1161 
1162     f++;
1163     f->name = "capitalize-word";
1164     f->func = F_CASECAPITAL;
1165     f->desc = CSAVS(3, 7,
1166 	"Capitalize the characters from cursor to end of current word");
1167 
1168     f++;
1169     f->name = "change-case";
1170     f->func = V_CHGCASE;
1171     f->desc = CSAVS(3, 8,
1172 	"Vi change case of character under cursor and advance one character");
1173 
1174     f++;
1175     f->name = "change-till-end-of-line";
1176     f->func = V_CHGTOEND;	/* backward compat. */
1177     f->desc = CSAVS(3, 9, "Vi change to end of line");
1178 
1179     f++;
1180     f->name = "clear-screen";
1181     f->func = F_CLEARDISP;
1182     f->desc = CSAVS(3, 10, "Clear screen leaving current line on top");
1183 
1184     f++;
1185     f->name = "complete-word";
1186     f->func = F_COMPLETE;
1187     f->desc = CSAVS(3, 11, "Complete current word");
1188 
1189     f++;
1190     f->name = "complete-word-fwd";
1191     f->func = F_COMPLETE_FWD;
1192     f->desc = CSAVS(3, 12, "Tab forward through files");
1193 
1194     f++;
1195     f->name = "complete-word-back";
1196     f->func = F_COMPLETE_BACK;
1197     f->desc = CSAVS(3, 13, "Tab backward through files");
1198 
1199     f++;
1200     f->name = "complete-word-raw";
1201     f->func = F_COMPLETE_ALL;
1202     f->desc = CSAVS(3, 14,
1203 	"Complete current word ignoring programmable completions");
1204 
1205     f++;
1206     f->name = "copy-prev-word";
1207     f->func = F_COPYPREV;
1208     f->desc = CSAVS(3, 15, "Copy current word to cursor");
1209 
1210     f++;
1211     f->name = "copy-region-as-kill";
1212     f->func = F_COPYREGION;
1213     f->desc = CSAVS(3, 16, "Copy area between mark and cursor to cut buffer");
1214 
1215     f++;
1216     f->name = "dabbrev-expand";
1217     f->func = F_DABBREV_EXPAND;
1218     f->desc = CSAVS(3, 17,
1219 		    "Expand to preceding word for which this is a prefix");
1220 
1221     f++;
1222     f->name = "delete-char";
1223     f->func = F_DELNEXT;
1224     f->desc = CSAVS(3, 18, "Delete character under cursor");
1225 
1226     f++;
1227     f->name = "delete-char-or-eof";
1228     f->func = F_DELNEXT_EOF;
1229     f->desc = CSAVS(3, 19,
1230 	"Delete character under cursor or signal end of file on an empty line");
1231 
1232     f++;
1233     f->name = "delete-char-or-list";
1234     f->func = F_DELNEXT_LIST;
1235     f->desc = CSAVS(3, 20,
1236 	"Delete character under cursor or list completions if at end of line");
1237 
1238     f++;
1239     f->name = "delete-char-or-list-or-eof";
1240     f->func = F_DELNEXT_LIST_EOF;
1241     f->desc = CSAVS(3, 21,
1242     "Delete character under cursor, list completions or signal end of file");
1243 
1244     f++;
1245     f->name = "delete-word";
1246     f->func = F_DELWORDNEXT;
1247     f->desc = CSAVS(3, 22,
1248 	"Cut from cursor to end of current word - save in cut buffer");
1249 
1250     f++;
1251     f->name = "digit";
1252     f->func = F_DIGIT;
1253     f->desc = CSAVS(3, 23, "Adds to argument if started or enters digit");
1254 
1255     f++;
1256     f->name = "digit-argument";
1257     f->func = F_ARGDIGIT;
1258     f->desc = CSAVS(3, 24, "Digit that starts argument");
1259 
1260     f++;
1261     f->name = "down-history";
1262     f->func = F_DOWN_HIST;
1263     f->desc = CSAVS(3, 25, "Move to next history line");
1264 
1265     f++;
1266     f->name = "downcase-word";
1267     f->func = F_CASELOWER;
1268     f->desc = CSAVS(3, 26,
1269 	"Lowercase the characters from cursor to end of current word");
1270 
1271     f++;
1272     f->name = "end-of-file";
1273     f->func = F_SEND_EOF;
1274     f->desc = CSAVS(3, 27, "Indicate end of file");
1275 
1276     f++;
1277     f->name = "end-of-line";
1278     f->func = F_TOEND;
1279     f->desc = CSAVS(3, 28, "Move cursor to end of line");
1280 
1281     f++;
1282     f->name = "exchange-point-and-mark";
1283     f->func = F_EXCHANGE_MARK;
1284     f->desc = CSAVS(3, 29, "Exchange the cursor and mark");
1285 
1286     f++;
1287     f->name = "expand-glob";
1288     f->func = F_EXPAND_GLOB;
1289     f->desc = CSAVS(3, 30, "Expand file name wildcards");
1290 
1291     f++;
1292     f->name = "expand-history";
1293     f->func = F_EXPAND_HISTORY;
1294     f->desc = CSAVS(3, 31, "Expand history escapes");
1295 
1296     f++;
1297     f->name = "expand-line";
1298     f->func = F_EXPAND;
1299     f->desc = CSAVS(3, 32, "Expand the history escapes in a line");
1300 
1301     f++;
1302     f->name = "expand-variables";
1303     f->func = F_EXPAND_VARS;
1304     f->desc = CSAVS(3, 33, "Expand variables");
1305 
1306     f++;
1307     f->name = "forward-char";
1308     f->func = F_CHARFWD;
1309     f->desc = CSAVS(3, 34, "Move forward one character");
1310 
1311     f++;
1312     f->name = "forward-word";
1313     f->func = F_WORDFWD;
1314     f->desc = CSAVS(3, 35, "Move forward to end of current word");
1315 
1316     f++;
1317     f->name = "gosmacs-transpose-chars";
1318     f->func = F_GCHARSWITCH;
1319     f->desc = CSAVS(3, 36, "Exchange the two characters before the cursor");
1320 
1321     f++;
1322     f->name = "history-search-backward";
1323     f->func = F_UP_SEARCH_HIST;
1324     f->desc = CSAVS(3, 37,
1325 	"Search in history backward for line beginning as current");
1326 
1327     f++;
1328     f->name = "history-search-forward";
1329     f->func = F_DOWN_SEARCH_HIST;
1330     f->desc = CSAVS(3, 38,
1331 	"Search in history forward for line beginning as current");
1332 
1333     f++;
1334     f->name = "insert-last-word";
1335     f->func = F_LAST_ITEM;
1336     f->desc = CSAVS(3, 39, "Insert last item of previous command");
1337 
1338     f++;
1339     f->name = "i-search-fwd";
1340     f->func = F_INC_FWD;
1341     f->desc = CSAVS(3, 40, "Incremental search forward");
1342 
1343     f++;
1344     f->name = "i-search-back";
1345     f->func = F_INC_BACK;
1346     f->desc = CSAVS(3, 41, "Incremental search backward");
1347 
1348     f++;
1349     f->name = "keyboard-quit";
1350     f->func = F_STARTOVER;
1351     f->desc = CSAVS(3, 42, "Clear line");
1352 
1353     f++;
1354     f->name = "kill-line";
1355     f->func = F_KILLEND;
1356     f->desc = CSAVS(3, 43, "Cut to end of line and save in cut buffer");
1357 
1358     f++;
1359     f->name = "kill-region";
1360     f->func = F_KILLREGION;
1361     f->desc = CSAVS(3, 44,
1362 	"Cut area between mark and cursor and save in cut buffer");
1363 
1364     f++;
1365     f->name = "kill-whole-line";
1366     f->func = F_KILLALL;
1367     f->desc = CSAVS(3, 45, "Cut the entire line and save in cut buffer");
1368 
1369     f++;
1370     f->name = "list-choices";
1371     f->func = F_LIST_CHOICES;
1372     f->desc = CSAVS(3, 46, "List choices for completion");
1373 
1374     f++;
1375     f->name = "list-choices-raw";
1376     f->func = F_LIST_ALL;
1377     f->desc = CSAVS(3, 47,
1378 	"List choices for completion overriding programmable completion");
1379 
1380     f++;
1381     f->name = "list-glob";
1382     f->func = F_LIST_GLOB;
1383     f->desc = CSAVS(3, 48, "List file name wildcard matches");
1384 
1385     f++;
1386     f->name = "list-or-eof";
1387     f->func = F_LIST_EOF;
1388     f->desc = CSAVS(3, 49,
1389 	"List choices for completion or indicate end of file if empty line");
1390 
1391     f++;
1392     f->name = "load-average";
1393     f->func = F_LOAD_AVERAGE;
1394     f->desc = CSAVS(3, 50, "Display load average and current process status");
1395 
1396     f++;
1397     f->name = "magic-space";
1398     f->func = F_MAGIC_SPACE;
1399     f->desc = CSAVS(3, 51, "Expand history escapes and insert a space");
1400 
1401     f++;
1402     f->name = "newline";
1403     f->func = F_NEWLINE;
1404     f->desc = CSAVS(3, 52, "Execute command");
1405 
1406     f++;
1407     f->name = "newline-and-hold";
1408     f->func = F_NEWLINE_HOLD;
1409     f->desc = CSAVS(3, 122, "Execute command and keep current line");
1410 
1411     f++;
1412     f->name = "newline-and-down-history";
1413     f->func = F_NEWLINE_DOWN_HIST;
1414     f->desc = CSAVS(3, 123, "Execute command and move to next history line");
1415 
1416     f++;
1417     f->name = "normalize-path";
1418     f->func = F_PATH_NORM;
1419     f->desc = CSAVS(3, 53,
1420 		    "Expand pathnames, eliminating leading .'s and ..'s");
1421 
1422     f++;
1423     f->name = "normalize-command";
1424     f->func = F_COMMAND_NORM;
1425     f->desc = CSAVS(3, 54,
1426 		    "Expand commands to the resulting pathname or alias");
1427 
1428     f++;
1429     f->name = "overwrite-mode";
1430     f->func = F_INSOVR;
1431     f->desc = CSAVS(3, 55,
1432 		    "Switch from insert to overwrite mode or vice versa");
1433 
1434     f++;
1435     f->name = "prefix-meta";
1436     f->func = F_METANEXT;
1437     f->desc = CSAVS(3, 56, "Add 8th bit to next character typed");
1438 
1439     f++;
1440     f->name = "quoted-insert";
1441     f->func = F_QUOTE;
1442     f->desc = CSAVS(3, 57, "Add the next character typed to the line verbatim");
1443 
1444     f++;
1445     f->name = "redisplay";
1446     f->func = F_REDISP;
1447     f->desc = CSAVS(3, 58, "Redisplay everything");
1448 
1449     f++;
1450     f->name = "run-fg-editor";
1451     f->func = F_RUN_FG_EDITOR;
1452     f->desc = CSAVS(3, 59, "Restart stopped editor");
1453 
1454     f++;
1455     f->name = "run-help";
1456     f->func = F_HELPME;
1457     f->desc = CSAVS(3, 60, "Look for help on current command");
1458 
1459     f++;
1460     f->name = "self-insert-command";
1461     f->func = F_INSERT;
1462     f->desc = CSAVS(3, 61, "This character is added to the line");
1463 
1464     f++;
1465     f->name = "sequence-lead-in";
1466     f->func = F_XKEY;
1467     f->desc = CSAVS(3, 62,
1468 	"This character is the first in a character sequence");
1469 
1470     f++;
1471     f->name = "set-mark-command";
1472     f->func = F_SET_MARK;
1473     f->desc = CSAVS(3, 63, "Set the mark at cursor");
1474 
1475     f++;
1476     f->name = "spell-word";
1477     f->func = F_CORRECT;
1478     f->desc = CSAVS(3, 64, "Correct the spelling of current word");
1479 
1480     f++;
1481     f->name = "spell-line";
1482     f->func = F_CORRECT_L;
1483     f->desc = CSAVS(3, 65, "Correct the spelling of entire line");
1484 
1485     f++;
1486     f->name = "stuff-char";
1487     f->func = F_STUFF_CHAR;
1488     f->desc = CSAVS(3, 66, "Send character to tty in cooked mode");
1489 
1490     f++;
1491     f->name = "toggle-literal-history";
1492     f->func = F_TOGGLE_HIST;
1493     f->desc = CSAVS(3, 67,
1494 	"Toggle between literal and lexical current history line");
1495 
1496     f++;
1497     f->name = "transpose-chars";
1498     f->func = F_CHARSWITCH;
1499     f->desc = CSAVS(3, 68,
1500 	"Exchange the character to the left of the cursor with the one under");
1501 
1502     f++;
1503     f->name = "transpose-gosling";
1504     f->func = F_GCHARSWITCH;
1505     f->desc = CSAVS(3, 69, "Exchange the two characters before the cursor");
1506 
1507     f++;
1508     f->name = "tty-dsusp";
1509     f->func = F_TTY_DSUSP;
1510     f->desc = CSAVS(3, 70, "Tty delayed suspend character");
1511 
1512     f++;
1513     f->name = "tty-flush-output";
1514     f->func = F_TTY_FLUSHO;
1515     f->desc = CSAVS(3, 71, "Tty flush output character");
1516 
1517     f++;
1518     f->name = "tty-sigintr";
1519     f->func = F_TTY_INT;
1520     f->desc = CSAVS(3, 72, "Tty interrupt character");
1521 
1522     f++;
1523     f->name = "tty-sigquit";
1524     f->func = F_TTY_QUIT;
1525     f->desc = CSAVS(3, 73, "Tty quit character");
1526 
1527     f++;
1528     f->name = "tty-sigtsusp";
1529     f->func = F_TTY_TSUSP;
1530     f->desc = CSAVS(3, 74, "Tty suspend character");
1531 
1532     f++;
1533     f->name = "tty-start-output";
1534     f->func = F_TTY_STARTO;
1535     f->desc = CSAVS(3, 75, "Tty allow output character");
1536 
1537     f++;
1538     f->name = "tty-stop-output";
1539     f->func = F_TTY_STOPO;
1540     f->desc = CSAVS(3, 76, "Tty disallow output character");
1541 
1542     f++;
1543     f->name = "undefined-key";
1544     f->func = F_UNASSIGNED;
1545     f->desc = CSAVS(3, 77, "Indicates unbound character");
1546 
1547     f++;
1548     f->name = "universal-argument";
1549     f->func = F_ARGFOUR;
1550     f->desc = CSAVS(3, 78, "Emacs universal argument (argument times 4)");
1551 
1552     f++;
1553     f->name = "up-history";
1554     f->func = F_UP_HIST;
1555     f->desc = CSAVS(3, 79, "Move to previous history line");
1556 
1557     f++;
1558     f->name = "upcase-word";
1559     f->func = F_CASEUPPER;
1560     f->desc = CSAVS(3, 80,
1561 	"Uppercase the characters from cursor to end of current word");
1562 
1563     f++;
1564     f->name = "vi-beginning-of-next-word";
1565     f->func = V_WORDBEGNEXT;
1566     f->desc = CSAVS(3, 81, "Vi goto the beginning of next word");
1567 
1568     f++;
1569     f->name = "vi-add";
1570     f->func = V_ADD;
1571     f->desc = CSAVS(3, 82, "Vi enter insert mode after the cursor");
1572 
1573     f++;
1574     f->name = "vi-add-at-eol";
1575     f->func = V_ADDEND;
1576     f->desc = CSAVS(3, 83, "Vi enter insert mode at end of line");
1577 
1578     f++;
1579     f->name = "vi-chg-case";
1580     f->func = V_CHGCASE;
1581     f->desc = CSAVS(3, 84,
1582 	"Vi change case of character under cursor and advance one character");
1583 
1584     f++;
1585     f->name = "vi-chg-meta";
1586     f->func = V_CHGMETA;
1587     f->desc = CSAVS(3, 85, "Vi change prefix command");
1588 
1589     f++;
1590     f->name = "vi-chg-to-eol";
1591     f->func = V_CHGTOEND;
1592     f->desc = CSAVS(3, 86, "Vi change to end of line");
1593 
1594     f++;
1595     f->name = "vi-cmd-mode";
1596     f->func = V_CMD_MODE;
1597     f->desc = CSAVS(3, 87,
1598 	"Enter vi command mode (use alternative key bindings)");
1599 
1600     f++;
1601     f->name = "vi-cmd-mode-complete";
1602     f->func = V_CM_COMPLETE;
1603     f->desc = CSAVS(3, 88, "Vi command mode complete current word");
1604 
1605     f++;
1606     f->name = "vi-delprev";
1607     f->func = V_DELPREV;
1608     f->desc = CSAVS(3, 89, "Vi move to previous character (backspace)");
1609 
1610     f++;
1611     f->name = "vi-delmeta";
1612     f->func = V_DELMETA;
1613     f->desc = CSAVS(3, 90, "Vi delete prefix command");
1614 
1615     f++;
1616     f->name = "vi-endword";
1617     f->func = V_ENDWORD;
1618     f->desc = CSAVS(3, 91,
1619 	"Vi move to the end of the current space delimited word");
1620 
1621     f++;
1622     f->name = "vi-eword";
1623     f->func = V_EWORD;
1624     f->desc = CSAVS(3, 92, "Vi move to the end of the current word");
1625 
1626     f++;
1627     f->name = "vi-char-back";
1628     f->func = V_CHAR_BACK;
1629     f->desc = CSAVS(3, 93, "Vi move to the character specified backward");
1630 
1631     f++;
1632     f->name = "vi-char-fwd";
1633     f->func = V_CHAR_FWD;
1634     f->desc = CSAVS(3, 94, "Vi move to the character specified forward");
1635 
1636     f++;
1637     f->name = "vi-charto-back";
1638     f->func = V_CHARTO_BACK;
1639     f->desc = CSAVS(3, 95, "Vi move up to the character specified backward");
1640 
1641     f++;
1642     f->name = "vi-charto-fwd";
1643     f->func = V_CHARTO_FWD;
1644     f->desc = CSAVS(3, 96, "Vi move up to the character specified forward");
1645 
1646     f++;
1647     f->name = "vi-insert";
1648     f->func = V_INSERT;
1649     f->desc = CSAVS(3, 97, "Enter vi insert mode");
1650 
1651     f++;
1652     f->name = "vi-insert-at-bol";
1653     f->func = V_INSBEG;
1654     f->desc = CSAVS(3, 98, "Enter vi insert mode at beginning of line");
1655 
1656     f++;
1657     f->name = "vi-repeat-char-fwd";
1658     f->func = V_RCHAR_FWD;
1659     f->desc = CSAVS(3, 99,
1660 	"Vi repeat current character search in the same search direction");
1661 
1662     f++;
1663     f->name = "vi-repeat-char-back";
1664     f->func = V_RCHAR_BACK;
1665     f->desc = CSAVS(3, 100,
1666 	"Vi repeat current character search in the opposite search direction");
1667 
1668     f++;
1669     f->name = "vi-repeat-search-fwd";
1670     f->func = V_RSRCH_FWD;
1671     f->desc = CSAVS(3, 101,
1672 	"Vi repeat current search in the same search direction");
1673 
1674     f++;
1675     f->name = "vi-repeat-search-back";
1676     f->func = V_RSRCH_BACK;
1677     f->desc = CSAVS(3, 102,
1678 	"Vi repeat current search in the opposite search direction");
1679 
1680     f++;
1681     f->name = "vi-replace-char";
1682     f->func = V_REPLONE;
1683     f->desc = CSAVS(3, 103,
1684 	"Vi replace character under the cursor with the next character typed");
1685 
1686     f++;
1687     f->name = "vi-replace-mode";
1688     f->func = V_REPLMODE;
1689     f->desc = CSAVS(3, 104, "Vi replace mode");
1690 
1691     f++;
1692     f->name = "vi-search-back";
1693     f->func = V_USH_META;
1694     f->desc = CSAVS(3, 105, "Vi search history backward");
1695 
1696     f++;
1697     f->name = "vi-search-fwd";
1698     f->func = V_DSH_META;
1699     f->desc = CSAVS(3, 106, "Vi search history forward");
1700 
1701     f++;
1702     f->name = "vi-substitute-char";
1703     f->func = V_SUBSTCHAR;
1704     f->desc = CSAVS(3, 107,
1705 	"Vi replace character under the cursor and enter insert mode");
1706 
1707     f++;
1708     f->name = "vi-substitute-line";
1709     f->func = V_SUBSTLINE;
1710     f->desc = CSAVS(3, 108, "Vi replace entire line");
1711 
1712     f++;
1713     f->name = "vi-word-back";
1714     f->func = V_WORDBACK;
1715     f->desc = CSAVS(3, 109, "Vi move to the previous word");
1716 
1717     f++;
1718     f->name = "vi-word-fwd";
1719     f->func = V_WORDFWD;
1720     f->desc = CSAVS(3, 110, "Vi move to the next word");
1721 
1722     f++;
1723     f->name = "vi-undo";
1724     f->func = V_UNDO;
1725     f->desc = CSAVS(3, 111, "Vi undo last change");
1726 
1727     f++;
1728     f->name = "vi-zero";
1729     f->func = V_ZERO;
1730     f->desc = CSAVS(3, 112, "Vi goto the beginning of line");
1731 
1732     f++;
1733     f->name = "which-command";
1734     f->func = F_WHICH;
1735     f->desc = CSAVS(3, 113, "Perform which of current command");
1736 
1737     f++;
1738     f->name = "yank";
1739     f->func = F_YANK_KILL;
1740     f->desc = CSAVS(3, 114, "Paste cut buffer at cursor position");
1741 
1742     f++;
1743     f->name = "yank-pop";
1744     f->func = F_YANK_POP;
1745     f->desc = CSAVS(3, 115,
1746 	"Replace just-yanked text with yank from earlier kill");
1747 
1748     f++;
1749     f->name = "e_dosify_next";
1750     f->func = F_DOSIFY_NEXT;
1751     f->desc = CSAVS(3, 118,
1752 	"(WIN32 only) Convert each '/' in next word to '\\\\'");
1753 
1754     f++;
1755     f->name = "e_dosify_prev";
1756     f->func = F_DOSIFY_PREV;
1757     f->desc = CSAVS(3, 119,
1758 	"(WIN32 only) Convert each '/' in previous word to '\\\\'");
1759 
1760     f++;
1761     f->name = "e_page_up";
1762     f->func = F_PAGE_UP;
1763     f->desc = CSAVS(3, 120, "(WIN32 only) Page visible console window up");
1764 
1765     f++;
1766     f->name = "e_page_down";
1767     f->func = F_PAGE_DOWN;
1768     f->desc = CSAVS(3, 121, "(WIN32 only) Page visible console window down");
1769 
1770     f++;
1771     f->name = NULL;
1772     f->func = 0;
1773     f->desc = NULL;
1774 
1775     f++;
1776     if (f - FuncNames != F_NUM_FUNCNAMES)
1777 	abort();
1778 }
1779 
1780 #ifdef DEBUG_EDIT
1781 void
1782 CheckMaps(void)
1783 {		/* check the size of the key maps */
1784     size_t     c1 = NT_NUM_KEYS * sizeof(KEYCMD);
1785 
1786     if (sizeof(CcKeyMap) != c1)
1787 	xprintf("CcKeyMap should be %u entries, but is %zu.\r\n",
1788 		NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD));
1789 
1790     if (sizeof(CcAltMap) != c1)
1791 	xprintf("CcAltMap should be %u entries, but is %zu.\r\n",
1792 		NT_NUM_KEYS, sizeof(CcAltMap) / sizeof(KEYCMD));
1793 
1794     if (sizeof(CcEmacsMap) != c1)
1795 	xprintf("CcEmacsMap should be %u entries, but is %zu.\r\n",
1796 		NT_NUM_KEYS, sizeof(CcEmacsMap) / sizeof(KEYCMD));
1797 
1798     if (sizeof(CcViMap) != c1)
1799 	xprintf("CcViMap should be %u entries, but is %zu.\r\n",
1800 		NT_NUM_KEYS, sizeof(CcViMap) / sizeof(KEYCMD));
1801 
1802     if (sizeof(CcViCmdMap) != c1)
1803 	xprintf("CcViCmdMap should be %u entries, but is %zu.\r\n",
1804 		NT_NUM_KEYS, sizeof(CcViCmdMap) / sizeof(KEYCMD));
1805 }
1806 
1807 #endif
1808 
1809 int    MapsAreInited = 0;
1810 int    NLSMapsAreInited = 0;
1811 int    NoNLSRebind;
1812 
1813 void
1814 ed_InitNLSMaps(void)
1815 {
1816     int i;
1817 
1818     if (AsciiOnly)
1819 	return;
1820     if (NoNLSRebind)
1821 	return;
1822     for (i = 0200; i <= 0377; i++) {
1823 	if (Isprint(CTL_ESC(i))) {
1824 	    CcKeyMap[CTL_ESC(i)] = F_INSERT;
1825 	}
1826     }
1827     NLSMapsAreInited = 1;
1828 }
1829 
1830 static void
1831 ed_InitMetaBindings(void)
1832 {
1833     Char    buf[3];
1834     int     i;
1835     CStr    cstr;
1836     KEYCMD *map;
1837 
1838     map = CcKeyMap;
1839     for (i = 0; i <= 0377 && CcKeyMap[CTL_ESC(i)] != F_METANEXT; i++)
1840 	continue;
1841     if (i > 0377) {
1842 	for (i = 0; i <= 0377 && CcAltMap[CTL_ESC(i)] != F_METANEXT; i++)
1843 	    continue;
1844 	if (i > 0377) {
1845 	    i = '\033';
1846 	    if (VImode)
1847 		map = CcAltMap;
1848 	}
1849 	else {
1850 	    map = CcAltMap;
1851 	}
1852     }
1853     buf[0] = (Char)CTL_ESC(i);
1854     buf[2] = 0;
1855     cstr.buf = buf;
1856     cstr.len = 2;
1857     for (i = 0200; i <= 0377; i++) {
1858 	if (map[CTL_ESC(i)] != F_INSERT && map[CTL_ESC(i)] != F_UNASSIGNED && map[CTL_ESC(i)] != F_XKEY) {
1859 	    buf[1] = CTL_ESC(i & ASCII);
1860 	    AddXkey(&cstr, XmapCmd((int) map[CTL_ESC(i)]), XK_CMD);
1861 	}
1862     }
1863     map[buf[0]] = F_XKEY;
1864 }
1865 
1866 void
1867 ed_InitVIMaps(void)
1868 {
1869     int i;
1870 
1871     VImode = 1;
1872     setNS(STRvimode);
1873     update_wordchars();
1874 
1875     ResetXmap();
1876     for (i = 0; i < NT_NUM_KEYS; i++) {
1877 	CcKeyMap[i] = CcViMap[i];
1878 	CcAltMap[i] = CcViCmdMap[i];
1879     }
1880     ed_InitMetaBindings();
1881     ed_InitNLSMaps();
1882     ResetArrowKeys();
1883     BindArrowKeys();
1884 }
1885 
1886 void
1887 ed_InitEmacsMaps(void)
1888 {
1889     int     i;
1890     Char    buf[3];
1891     CStr    cstr;
1892     cstr.buf = buf;
1893     cstr.len = 2;
1894 
1895     VImode = 0;
1896     if (adrof(STRvimode))
1897 	unsetv(STRvimode);
1898     update_wordchars();
1899 
1900     ResetXmap();
1901     for (i = 0; i < NT_NUM_KEYS; i++) {
1902 	CcKeyMap[i] = CcEmacsMap[i];
1903 	CcAltMap[i] = F_UNASSIGNED;
1904     }
1905     ed_InitMetaBindings();
1906     ed_InitNLSMaps();
1907     buf[0] = CTL_ESC('\030');
1908     buf[2] = 0;
1909     buf[1] = CTL_ESC('\030');
1910     AddXkey(&cstr, XmapCmd(F_EXCHANGE_MARK), XK_CMD);
1911     buf[1] = '*';
1912     AddXkey(&cstr, XmapCmd(F_EXPAND_GLOB),   XK_CMD);
1913     buf[1] = '$';
1914     AddXkey(&cstr, XmapCmd(F_EXPAND_VARS),   XK_CMD);
1915     buf[1] = 'G';
1916     AddXkey(&cstr, XmapCmd(F_LIST_GLOB),     XK_CMD);
1917     buf[1] = 'g';
1918     AddXkey(&cstr, XmapCmd(F_LIST_GLOB),     XK_CMD);
1919     buf[1] = 'n';
1920     AddXkey(&cstr, XmapCmd(F_PATH_NORM),     XK_CMD);
1921     buf[1] = 'N';
1922     AddXkey(&cstr, XmapCmd(F_PATH_NORM),     XK_CMD);
1923     buf[1] = '?';
1924     AddXkey(&cstr, XmapCmd(F_COMMAND_NORM),  XK_CMD);
1925     buf[1] = '\t';
1926     AddXkey(&cstr, XmapCmd(F_COMPLETE_ALL),  XK_CMD);
1927     buf[1] = CTL_ESC('\004');	/* ^D */
1928     AddXkey(&cstr, XmapCmd(F_LIST_ALL),      XK_CMD);
1929     ResetArrowKeys();
1930     BindArrowKeys();
1931 }
1932 
1933 void
1934 ed_InitMaps(void)
1935 {
1936     if (MapsAreInited)
1937 	return;
1938 #ifndef IS_ASCII
1939     /* This machine has an EBCDIC charset. The assumptions made for the
1940      * initialized keymaps therefore don't hold, since they are based on
1941      * ASCII (or ISO8859-1).
1942      * Here, we do a one-time transformation to EBCDIC environment
1943      * for the key initializations.
1944      */
1945     {
1946 	KEYCMD temp[NT_NUM_KEYS];
1947 	static KEYCMD *const list[3] = { CcEmacsMap, CcViMap, CcViCmdMap };
1948 	int i, table;
1949 
1950 	for (table=0; table<3; ++table)
1951 	{
1952 	    /* copy ASCII ordered map to temp table */
1953 	    for (i = 0; i < NT_NUM_KEYS; i++) {
1954 		temp[i] = list[table][i];
1955 	    }
1956 	    /* write back as EBCDIC ordered map */
1957 	    for (i = 0; i < NT_NUM_KEYS; i++) {
1958 		list[table][_toebcdic[i]] = temp[i];
1959 	    }
1960 	}
1961     }
1962 #endif /* !IS_ASCII */
1963 
1964 #ifdef VIDEFAULT
1965     ed_InitVIMaps();
1966 #else
1967     ed_InitEmacsMaps();
1968 #endif
1969 
1970     MapsAreInited = 1;
1971 }
1972