2002-12-26 01:53:07 +03:00
|
|
|
/* Editor key translation.
|
2002-12-23 13:13:35 +03:00
|
|
|
|
2007-09-25 19:33:35 +04:00
|
|
|
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
|
|
|
2005, 2006, 2007 Free Software Foundation, Inc.
|
2005-02-07 10:31:19 +03:00
|
|
|
|
2002-12-23 13:13:35 +03:00
|
|
|
Authors: 1996, 1997 Paul Sheer
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2005-02-07 10:31:19 +03:00
|
|
|
|
2002-12-23 13:13:35 +03:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-27 07:35:10 +04:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA.
|
2002-12-23 13:13:35 +03:00
|
|
|
*/
|
|
|
|
|
2009-02-07 00:09:50 +03:00
|
|
|
/** \file
|
|
|
|
* \brief Source: editor key translation
|
|
|
|
*/
|
|
|
|
|
2002-12-23 13:13:35 +03:00
|
|
|
#include <config.h>
|
2005-02-22 20:00:36 +03:00
|
|
|
|
2005-07-20 15:56:30 +04:00
|
|
|
#include <assert.h>
|
2005-02-22 20:00:36 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "../src/global.h"
|
|
|
|
|
2009-06-14 19:18:27 +04:00
|
|
|
#include "edit-impl.h"
|
2002-12-23 13:13:35 +03:00
|
|
|
#include "edit-widget.h" /* edit->macro_i */
|
2009-04-29 17:13:12 +04:00
|
|
|
#include "editcmd_dialogs.h"
|
2002-12-23 13:13:35 +03:00
|
|
|
#include "editcmddef.h" /* list of commands */
|
2003-10-29 11:54:22 +03:00
|
|
|
#include "../src/key.h" /* KEY_M_SHIFT */
|
|
|
|
#include "../src/tty.h" /* keys */
|
|
|
|
#include "../src/charsets.h" /* convert_from_input_c() */
|
2009-04-16 19:12:33 +04:00
|
|
|
#include "../src/main.h" /* display_codepage */
|
2009-04-17 01:28:02 +04:00
|
|
|
#include "../src/strutil.h" /* str_isutf8 () */
|
2002-12-23 13:13:35 +03:00
|
|
|
|
2002-12-26 01:53:07 +03:00
|
|
|
/*
|
|
|
|
* Ordinary translations. Note that the keys listed first take priority
|
|
|
|
* when the key is assigned to more than one command.
|
|
|
|
*/
|
2005-07-20 15:56:30 +04:00
|
|
|
static const edit_key_map_type cooledit_key_map[] = {
|
2005-08-10 20:47:44 +04:00
|
|
|
{ ALT ('b'), CK_Match_Bracket },
|
|
|
|
{ ALT ('m'), CK_Mail },
|
|
|
|
{ XCTRL ('f'), CK_Save_Block },
|
|
|
|
{ XCTRL ('n'), CK_New },
|
|
|
|
{ XCTRL ('p'), CK_Pipe_Block (1) }, /* spell check */
|
|
|
|
{ XCTRL ('x'), CK_Word_Right },
|
|
|
|
{ XCTRL ('y'), CK_Delete_Line },
|
|
|
|
{ XCTRL ('z'), CK_Word_Left },
|
|
|
|
{ 0, 0 }
|
2002-12-26 01:53:07 +03:00
|
|
|
};
|
|
|
|
|
2005-07-20 15:56:30 +04:00
|
|
|
static const edit_key_map_type emacs_key_map[] = {
|
2005-08-10 20:47:44 +04:00
|
|
|
{ ALT ('$'), CK_Pipe_Block (1) }, /* spell check */
|
|
|
|
{ ALT ('b'), CK_Word_Left },
|
|
|
|
{ ALT ('f'), CK_Word_Right },
|
|
|
|
{ ALT ('v'), CK_Page_Up },
|
|
|
|
{ ALT ('w'), CK_XStore },
|
|
|
|
{ XCTRL ('@'), CK_Mark },
|
|
|
|
{ XCTRL ('a'), CK_Home },
|
|
|
|
{ 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 },
|
|
|
|
{ XCTRL ('v'), CK_Page_Down },
|
|
|
|
{ XCTRL ('w'), CK_XCut },
|
|
|
|
{ XCTRL ('y'), CK_XPaste },
|
|
|
|
{ 0, 0 }
|
2003-06-14 09:02:33 +04:00
|
|
|
};
|
|
|
|
|
2005-07-20 15:56:30 +04:00
|
|
|
static const edit_key_map_type common_key_map[] = {
|
2005-08-10 20:47:44 +04:00
|
|
|
{ '\n', CK_Enter },
|
|
|
|
{ '\t', CK_Tab },
|
|
|
|
|
|
|
|
{ ESC_CHAR, CK_Exit },
|
|
|
|
{ KEY_BACKSPACE, CK_BackSpace },
|
|
|
|
{ KEY_DC, CK_Delete },
|
|
|
|
{ KEY_DOWN, CK_Down },
|
|
|
|
{ KEY_END, CK_End },
|
|
|
|
{ KEY_HOME, CK_Home },
|
|
|
|
{ KEY_IC, CK_Toggle_Insert },
|
|
|
|
{ KEY_LEFT, CK_Left },
|
|
|
|
{ KEY_NPAGE, CK_Page_Down },
|
|
|
|
{ KEY_PPAGE, CK_Page_Up },
|
|
|
|
{ KEY_RIGHT, CK_Right },
|
|
|
|
{ KEY_UP, CK_Up },
|
|
|
|
|
2009-02-26 00:53:52 +03:00
|
|
|
{ ALT ('\n'), CK_Find_Definition },
|
2005-08-10 20:47:44 +04:00
|
|
|
{ ALT ('\t'), CK_Complete_Word },
|
|
|
|
{ ALT ('l'), CK_Goto },
|
|
|
|
{ ALT ('L'), CK_Goto },
|
|
|
|
{ ALT ('p'), CK_Paragraph_Format },
|
|
|
|
{ ALT ('t'), CK_Sort },
|
|
|
|
{ ALT ('u'), CK_ExtCmd },
|
|
|
|
{ ALT ('<'), CK_Beginning_Of_Text },
|
|
|
|
{ ALT ('>'), CK_End_Of_Text },
|
2009-02-26 00:53:52 +03:00
|
|
|
{ ALT ('-'), CK_Load_Prev_File },
|
|
|
|
{ ALT ('='), CK_Load_Next_File },
|
2005-08-10 20:47:44 +04:00
|
|
|
{ ALT (KEY_BACKSPACE), CK_Delete_Word_Left },
|
2009-05-12 01:15:55 +04:00
|
|
|
{ ALT ('n'), CK_Toggle_Line_State },
|
2009-07-01 20:18:20 +04:00
|
|
|
{ ALT ('_'), CK_Toggle_Tab_TWS },
|
2005-08-10 20:47:44 +04:00
|
|
|
|
|
|
|
{ XCTRL ('k'), CK_Delete_To_Line_End },
|
|
|
|
{ XCTRL ('l'), CK_Refresh },
|
|
|
|
{ XCTRL ('o'), CK_Shell },
|
2006-02-01 20:07:11 +03:00
|
|
|
{ XCTRL ('s'), CK_Toggle_Syntax },
|
2005-08-10 20:47:44 +04:00
|
|
|
{ XCTRL ('u'), CK_Undo },
|
|
|
|
{ XCTRL ('t'), CK_Select_Codepage },
|
|
|
|
{ XCTRL ('q'), CK_Insert_Literal },
|
|
|
|
{ XCTRL ('a'), CK_Execute_Macro },
|
|
|
|
{ XCTRL ('r'), CK_Begin_End_Macro },
|
|
|
|
|
|
|
|
{ KEY_F (1), CK_Help },
|
|
|
|
{ KEY_F (2), CK_Save },
|
|
|
|
{ KEY_F (3), CK_Mark },
|
|
|
|
{ KEY_F (4), CK_Replace },
|
|
|
|
{ KEY_F (5), CK_Copy },
|
|
|
|
{ KEY_F (6), CK_Move },
|
|
|
|
{ KEY_F (7), CK_Find },
|
|
|
|
{ KEY_F (8), CK_Remove },
|
|
|
|
{ KEY_F (10), CK_Exit },
|
|
|
|
{ KEY_F (11), CK_User_Menu }, /* edit user menu */
|
|
|
|
{ KEY_F (12), CK_Save_As },
|
|
|
|
{ KEY_F (13), CK_Column_Mark },
|
|
|
|
{ KEY_F (14), CK_Replace_Again },
|
|
|
|
{ KEY_F (15), CK_Insert_File },
|
|
|
|
{ KEY_F (17), CK_Find_Again },
|
|
|
|
{ KEY_F (19), CK_Pipe_Block (0) }, /* C formatter */
|
2002-12-26 01:53:07 +03:00
|
|
|
|
|
|
|
/* Shift */
|
2005-08-10 20:47:44 +04:00
|
|
|
{ KEY_M_SHIFT | KEY_PPAGE, CK_Page_Up_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_NPAGE, CK_Page_Down_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_LEFT, CK_Left_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_RIGHT, CK_Right_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_UP, CK_Up_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_DOWN, CK_Down_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_HOME, CK_Home_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_END, CK_End_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_IC, CK_XPaste },
|
|
|
|
{ KEY_M_SHIFT | KEY_DC, CK_XCut },
|
|
|
|
{ KEY_M_SHIFT | '\n', CK_Return }, /* useful for pasting multiline text */
|
2002-12-26 01:53:07 +03:00
|
|
|
|
2009-06-12 16:54:52 +04:00
|
|
|
/* Alt */
|
|
|
|
{ KEY_M_ALT | KEY_PPAGE, CK_Page_Up_Alt_Highlight },
|
|
|
|
{ KEY_M_ALT | KEY_NPAGE, CK_Page_Down_Highlight },
|
|
|
|
{ KEY_M_ALT | KEY_LEFT, CK_Left_Alt_Highlight },
|
|
|
|
{ KEY_M_ALT | KEY_RIGHT, CK_Right_Alt_Highlight },
|
|
|
|
{ KEY_M_ALT | KEY_UP, CK_Up_Alt_Highlight },
|
|
|
|
{ KEY_M_ALT | KEY_DOWN, CK_Down_Alt_Highlight },
|
|
|
|
{ KEY_M_ALT | KEY_HOME, CK_Home_Highlight },
|
|
|
|
{ KEY_M_ALT | KEY_END, CK_End_Alt_Highlight },
|
|
|
|
|
2002-12-26 01:53:07 +03:00
|
|
|
/* Ctrl */
|
2005-08-10 20:47:44 +04:00
|
|
|
{ KEY_M_CTRL | (KEY_F (2)), CK_Save_As },
|
|
|
|
{ KEY_M_CTRL | (KEY_F (4)), CK_Replace_Again },
|
|
|
|
{ KEY_M_CTRL | (KEY_F (7)), CK_Find_Again },
|
|
|
|
{ KEY_M_CTRL | KEY_BACKSPACE, CK_Undo },
|
|
|
|
{ KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text },
|
|
|
|
{ KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text },
|
|
|
|
{ KEY_M_CTRL | KEY_HOME, CK_Beginning_Of_Text },
|
|
|
|
{ KEY_M_CTRL | KEY_END, CK_End_Of_Text },
|
|
|
|
{ KEY_M_CTRL | KEY_UP, CK_Scroll_Up },
|
|
|
|
{ KEY_M_CTRL | KEY_DOWN, CK_Scroll_Down },
|
|
|
|
{ KEY_M_CTRL | KEY_LEFT, CK_Word_Left },
|
|
|
|
{ KEY_M_CTRL | KEY_RIGHT, CK_Word_Right },
|
|
|
|
{ KEY_M_CTRL | KEY_IC, CK_XStore },
|
|
|
|
{ KEY_M_CTRL | KEY_DC, CK_Remove },
|
2002-12-26 01:53:07 +03:00
|
|
|
|
2003-06-14 09:02:33 +04:00
|
|
|
/* Ctrl + Shift */
|
2005-08-10 20:47:44 +04:00
|
|
|
{ KEY_M_SHIFT | KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_M_CTRL | KEY_LEFT, CK_Word_Left_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_M_CTRL | KEY_RIGHT, CK_Word_Right_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_M_CTRL | KEY_UP, CK_Scroll_Up_Highlight },
|
|
|
|
{ KEY_M_SHIFT | KEY_M_CTRL | KEY_DOWN, CK_Scroll_Down_Highlight },
|
|
|
|
|
|
|
|
{ 0, 0 }
|
2002-12-26 01:53:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Translate the keycode into either 'command' or 'char_for_insertion'.
|
|
|
|
* 'command' is one of the editor commands from editcmddef.h.
|
|
|
|
*/
|
2002-12-23 13:13:35 +03:00
|
|
|
int
|
2002-12-26 01:53:07 +03:00
|
|
|
edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
|
2002-12-23 13:13:35 +03:00
|
|
|
{
|
2004-02-05 02:09:22 +03:00
|
|
|
int command = CK_Insert_Char;
|
2002-12-23 13:13:35 +03:00
|
|
|
int char_for_insertion = -1;
|
|
|
|
int i = 0;
|
2005-07-20 15:56:30 +04:00
|
|
|
int extmod = 0;
|
2009-04-16 19:12:33 +04:00
|
|
|
int c;
|
2002-12-23 13:13:35 +03:00
|
|
|
|
2005-07-20 15:56:30 +04:00
|
|
|
const edit_key_map_type *key_map = NULL;
|
2002-12-23 13:13:35 +03:00
|
|
|
switch (edit_key_emulation) {
|
|
|
|
case EDIT_KEY_EMULATION_NORMAL:
|
|
|
|
key_map = cooledit_key_map;
|
|
|
|
break;
|
|
|
|
case EDIT_KEY_EMULATION_EMACS:
|
|
|
|
key_map = emacs_key_map;
|
|
|
|
if (x_key == XCTRL ('x')) {
|
|
|
|
int ext_key;
|
|
|
|
ext_key =
|
2009-04-29 17:13:12 +04:00
|
|
|
editcmd_dialog_raw_key_query (" Ctrl-X ", _(" Emacs key: "), 0);
|
2002-12-23 13:13:35 +03:00
|
|
|
switch (ext_key) {
|
|
|
|
case 's':
|
|
|
|
command = CK_Save;
|
|
|
|
goto fin;
|
|
|
|
case 'x':
|
|
|
|
command = CK_Exit;
|
|
|
|
goto fin;
|
|
|
|
case 'k':
|
|
|
|
command = CK_New;
|
|
|
|
goto fin;
|
|
|
|
case 'e':
|
|
|
|
command =
|
2009-04-29 17:13:12 +04:00
|
|
|
CK_Macro (editcmd_dialog_raw_key_query
|
2002-12-23 13:13:35 +03:00
|
|
|
(_(" Execute Macro "),
|
|
|
|
_(" Press macro hotkey: "), 1));
|
|
|
|
if (command == CK_Macro (0))
|
2004-02-05 02:09:22 +03:00
|
|
|
command = CK_Insert_Char;
|
2002-12-23 13:13:35 +03:00
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-07-20 15:56:30 +04:00
|
|
|
case EDIT_KEY_EMULATION_USER:
|
|
|
|
if (edit->user_map != NULL) {
|
|
|
|
if (edit->extmod && edit->ext_map != NULL) {
|
|
|
|
key_map = edit->ext_map;
|
|
|
|
extmod = 1;
|
|
|
|
} else {
|
|
|
|
key_map = edit->user_map;
|
|
|
|
}
|
|
|
|
edit->extmod = 0;
|
|
|
|
} else {
|
|
|
|
key_map = edit->user_map = cooledit_key_map;
|
2002-12-23 13:13:35 +03:00
|
|
|
}
|
2005-07-20 15:56:30 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
assert (key_map != NULL);
|
2002-12-23 13:13:35 +03:00
|
|
|
|
|
|
|
/* an ordinary insertable character */
|
2005-07-20 15:56:30 +04:00
|
|
|
if (x_key < 256 && !extmod) {
|
2009-04-20 09:51:32 +04:00
|
|
|
#ifdef HAVE_CHARSET
|
2009-04-16 19:12:33 +04:00
|
|
|
if ( edit->charpoint >= 4 ) {
|
|
|
|
edit->charpoint = 0;
|
|
|
|
edit->charbuf[edit->charpoint] = '\0';
|
|
|
|
}
|
|
|
|
if ( edit->charpoint < 4 ) {
|
|
|
|
edit->charbuf[edit->charpoint++] = x_key;
|
|
|
|
edit->charbuf[edit->charpoint] = '\0';
|
|
|
|
}
|
2002-12-23 13:13:35 +03:00
|
|
|
|
2009-04-18 18:50:05 +04:00
|
|
|
/* input from 8-bit locale */
|
|
|
|
if ( !utf8_display ) {
|
|
|
|
/* source in 8-bit codeset */
|
|
|
|
if (!edit->utf8) {
|
2009-04-20 09:51:32 +04:00
|
|
|
#endif
|
2009-04-16 19:12:33 +04:00
|
|
|
c = convert_from_input_c (x_key);
|
|
|
|
if (is_printable (c)) {
|
|
|
|
char_for_insertion = c;
|
|
|
|
goto fin;
|
|
|
|
}
|
2009-04-20 09:51:32 +04:00
|
|
|
#ifdef HAVE_CHARSET
|
2009-04-18 18:50:05 +04:00
|
|
|
} else {
|
2009-04-20 13:01:47 +04:00
|
|
|
c = convert_from_input_c (x_key);
|
|
|
|
if (is_printable (c)) {
|
|
|
|
char_for_insertion = convert_from_8bit_to_utf_c2((unsigned char) x_key);
|
|
|
|
goto fin;
|
|
|
|
}
|
2009-04-18 18:50:05 +04:00
|
|
|
}
|
|
|
|
/* UTF-8 locale */
|
|
|
|
} else {
|
|
|
|
/* source in UTF-8 codeset */
|
|
|
|
if ( edit->utf8 ) {
|
|
|
|
int res = str_is_valid_char (edit->charbuf, edit->charpoint);
|
|
|
|
if (res < 0) {
|
|
|
|
if (res != -2) {
|
|
|
|
edit->charpoint = 0; /* broken multibyte char, skip */
|
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
char_for_insertion = x_key;
|
|
|
|
goto fin;
|
|
|
|
} else {
|
|
|
|
edit->charbuf[edit->charpoint]='\0';
|
|
|
|
edit->charpoint = 0;
|
|
|
|
if ( g_unichar_isprint (g_utf8_get_char(edit->charbuf))) {
|
|
|
|
char_for_insertion = x_key;
|
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 8-bit source */
|
2009-04-16 19:12:33 +04:00
|
|
|
} else {
|
|
|
|
int res = str_is_valid_char (edit->charbuf, edit->charpoint);
|
|
|
|
if (res < 0) {
|
|
|
|
if (res != -2) {
|
|
|
|
edit->charpoint = 0; /* broken multibyte char, skip */
|
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
/* not finised multibyte input (in meddle multibyte utf-8 char) */
|
|
|
|
goto fin;
|
|
|
|
} else {
|
|
|
|
if ( g_unichar_isprint (g_utf8_get_char(edit->charbuf)) ) {
|
|
|
|
c = convert_from_utf_to_current ( edit->charbuf );
|
|
|
|
edit->charbuf[0] = '\0';
|
|
|
|
edit->charpoint = 0;
|
2009-04-20 18:46:22 +04:00
|
|
|
char_for_insertion = c;
|
|
|
|
goto fin;
|
2009-04-16 19:12:33 +04:00
|
|
|
}
|
|
|
|
/* unprinteble utf input, skip it */
|
|
|
|
edit->charbuf[0] = '\0';
|
|
|
|
edit->charpoint = 0;
|
|
|
|
}
|
2009-04-13 19:19:06 +04:00
|
|
|
}
|
|
|
|
}
|
2009-04-20 09:51:32 +04:00
|
|
|
#endif
|
2002-12-23 13:13:35 +03:00
|
|
|
}
|
|
|
|
|
2002-12-26 01:53:07 +03:00
|
|
|
/* Commands specific to the key emulation */
|
2005-07-20 15:56:30 +04:00
|
|
|
for (i = 0; key_map[i].key != 0 && key_map[i].key != x_key; i++)
|
|
|
|
continue;
|
|
|
|
if (key_map[i].key != 0) {
|
|
|
|
command = key_map[i].command;
|
2002-12-26 01:53:07 +03:00
|
|
|
goto fin;
|
2004-02-05 02:09:22 +03:00
|
|
|
}
|
2002-12-26 01:53:07 +03:00
|
|
|
|
|
|
|
/* Commands common for the key emulations */
|
|
|
|
key_map = common_key_map;
|
2005-07-20 15:56:30 +04:00
|
|
|
for (i = 0; key_map[i].key != 0 && key_map[i].key != x_key; i++)
|
|
|
|
continue;
|
|
|
|
if (key_map[i].key != 0) {
|
|
|
|
command = key_map[i].command;
|
2002-12-23 13:13:35 +03:00
|
|
|
goto fin;
|
2004-02-05 02:09:22 +03:00
|
|
|
}
|
2002-12-23 13:13:35 +03:00
|
|
|
|
2002-12-26 01:53:07 +03:00
|
|
|
/* Function still not found for this key, so try macros */
|
2005-02-07 10:31:19 +03:00
|
|
|
/* This allows the same macro to be
|
2002-12-23 13:13:35 +03:00
|
|
|
enabled by either eg "ALT('f')" or "XCTRL('f')" or "XCTRL('a'), 'f'" */
|
|
|
|
|
|
|
|
if (x_key & ALT (0)) { /* is an alt key ? */
|
|
|
|
command = CK_Macro (x_key - ALT (0));
|
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
if (x_key < ' ') { /* is a ctrl key ? */
|
|
|
|
command = CK_Macro (x_key);
|
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
fin:
|
|
|
|
|
|
|
|
*cmd = command;
|
|
|
|
*ch = char_for_insertion;
|
|
|
|
|
2004-02-05 02:09:22 +03:00
|
|
|
if (command == CK_Insert_Char && char_for_insertion == -1) {
|
2002-12-23 13:13:35 +03:00
|
|
|
/* unchanged, key has no function here */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|