* editcmddef.h: Split CK_No_Command into CK_Insert_Char and

CK_Ignore_Key.
* editkeys.c (emacs_key_map): Ignore Ctrl-g.  Requested by
Paul Seelig <pseelig@uni-mainz.de>
(edit_translate_key): Implement CK_Ignore_Key.
This commit is contained in:
Pavel Roskin 2004-02-04 23:09:22 +00:00
parent 90ae5d102d
commit 603e2af580
3 changed files with 23 additions and 11 deletions

View File

@ -1,5 +1,11 @@
2004-02-04 Pavel Roskin <proski@gnu.org>
* editcmddef.h: Split CK_No_Command into CK_Insert_Char and
CK_Ignore_Key.
* editkeys.c (emacs_key_map): Ignore Ctrl-g. Requested by
Paul Seelig <pseelig@uni-mainz.de>
(edit_translate_key): Implement CK_Ignore_Key.
* edit.c (edit_execute_key_command): Return void, the result is
never used.
(edit_execute_cmd): Likewise.

View File

@ -4,8 +4,11 @@
/* in the distant future, keyboards will be invented with a
separate key for each one of these commands *sigh* */
/* special commands */
#define CK_Insert_Char -1
#define CK_Ignore_Key 0
/* cursor movements */
#define CK_No_Command -1
#define CK_BackSpace 1
#define CK_Delete 2
#define CK_Enter 3

View File

@ -56,6 +56,7 @@ static long const emacs_key_map[] = {
XCTRL ('b'), CK_Left,
XCTRL ('e'), CK_End,
XCTRL ('f'), CK_Right,
XCTRL ('g'), CK_Ignore_Key,
XCTRL ('n'), CK_Down,
XCTRL ('p'), CK_Up,
XCTRL ('s'), CK_Find,
@ -163,7 +164,7 @@ static long const common_key_map[] = {
int
edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
{
int command = -1;
int command = CK_Insert_Char;
int char_for_insertion = -1;
int i = 0;
static const long *key_map;
@ -194,7 +195,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
(_(" Execute Macro "),
_(" Press macro hotkey: "), 1));
if (command == CK_Macro (0))
command = -1;
command = CK_Insert_Char;
goto fin;
}
goto fin;
@ -225,7 +226,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
(_(" Execute Macro "), _(" Press macro hotkey: "),
1));
if (command == CK_Macro (0))
command = -1;
command = CK_Insert_Char;
goto fin;
}
/* edit is a pointer to the widget */
@ -250,20 +251,22 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
/* Commands specific to the key emulation */
i = 0;
while (key_map[i] != x_key && (key_map[i] || key_map[i + 1]))
while (key_map[i] && (key_map[i] != x_key))
i += 2;
if (key_map[i]) {
command = key_map[i + 1];
if (command)
goto fin;
}
/* Commands common for the key emulations */
key_map = common_key_map;
i = 0;
while (key_map[i] != x_key && (key_map[i] || key_map[i + 1]))
while (key_map[i] && (key_map[i] != x_key))
i += 2;
if (key_map[i]) {
command = key_map[i + 1];
if (command)
goto fin;
}
/* Function still not found for this key, so try macros */
/* This allows the same macro to be
@ -282,7 +285,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
*cmd = command;
*ch = char_for_insertion;
if ((command == -1 || command == 0) && char_for_insertion == -1) {
if (command == CK_Insert_Char && char_for_insertion == -1) {
/* unchanged, key has no function here */
return 0;
}