mirror of https://github.com/MidnightCommander/mc
* key.c (correct_key_code): Convert unrecognized 0177, Ctrl-h
and Ctrl-d into Delete and Backspace. Remove all references to those keys in other files.
This commit is contained in:
parent
44aac01193
commit
867704615b
|
@ -35,10 +35,7 @@
|
||||||
*/
|
*/
|
||||||
static const long cooledit_key_map[] = {
|
static const long cooledit_key_map[] = {
|
||||||
KEY_BACKSPACE, CK_BackSpace,
|
KEY_BACKSPACE, CK_BackSpace,
|
||||||
0177, CK_BackSpace,
|
|
||||||
XCTRL ('h'), CK_BackSpace,
|
|
||||||
KEY_DC, CK_Delete,
|
KEY_DC, CK_Delete,
|
||||||
XCTRL ('d'), CK_Delete,
|
|
||||||
'\n', CK_Enter,
|
'\n', CK_Enter,
|
||||||
KEY_PPAGE, CK_Page_Up,
|
KEY_PPAGE, CK_Page_Up,
|
||||||
KEY_NPAGE, CK_Page_Down,
|
KEY_NPAGE, CK_Page_Down,
|
||||||
|
@ -90,10 +87,7 @@ static const long cooledit_key_map[] = {
|
||||||
|
|
||||||
static long const emacs_key_map[] = {
|
static long const emacs_key_map[] = {
|
||||||
KEY_BACKSPACE, CK_BackSpace,
|
KEY_BACKSPACE, CK_BackSpace,
|
||||||
0177, CK_BackSpace,
|
|
||||||
XCTRL ('h'), CK_BackSpace,
|
|
||||||
KEY_DC, CK_Delete,
|
KEY_DC, CK_Delete,
|
||||||
XCTRL ('d'), CK_Delete,
|
|
||||||
'\n', CK_Enter,
|
'\n', CK_Enter,
|
||||||
KEY_PPAGE, CK_Page_Up,
|
KEY_PPAGE, CK_Page_Up,
|
||||||
KEY_NPAGE, CK_Page_Down,
|
KEY_NPAGE, CK_Page_Down,
|
||||||
|
@ -180,7 +174,6 @@ static long const common_key_map[] = {
|
||||||
KEY_M_CTRL | (KEY_F (4)), CK_Replace_Again,
|
KEY_M_CTRL | (KEY_F (4)), CK_Replace_Again,
|
||||||
KEY_M_CTRL | (KEY_F (7)), CK_Find_Again,
|
KEY_M_CTRL | (KEY_F (7)), CK_Find_Again,
|
||||||
KEY_M_CTRL | KEY_BACKSPACE, CK_Undo,
|
KEY_M_CTRL | KEY_BACKSPACE, CK_Undo,
|
||||||
KEY_M_CTRL | 0177, CK_Undo,
|
|
||||||
KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text,
|
KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text,
|
||||||
KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text,
|
KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text,
|
||||||
KEY_M_CTRL | KEY_HOME, CK_Beginning_Of_Text,
|
KEY_M_CTRL | KEY_HOME, CK_Beginning_Of_Text,
|
||||||
|
@ -194,7 +187,6 @@ static long const common_key_map[] = {
|
||||||
|
|
||||||
/* Alt */
|
/* Alt */
|
||||||
KEY_M_ALT | KEY_BACKSPACE, CK_Delete_Word_Left,
|
KEY_M_ALT | KEY_BACKSPACE, CK_Delete_Word_Left,
|
||||||
KEY_M_ALT | 0177, CK_Delete_Word_Left,
|
|
||||||
|
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
2003-03-10 Pavel Roskin <proski@gnu.org>
|
2003-03-10 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* key.c (correct_key_code): Convert unrecognized 0177, Ctrl-h
|
||||||
|
and Ctrl-d into Delete and Backspace. Remove all references to
|
||||||
|
those keys in other files.
|
||||||
|
|
||||||
* key.c (get_modifier) [__QNXNTO__]: Remove incorrect check for
|
* key.c (get_modifier) [__QNXNTO__]: Remove incorrect check for
|
||||||
the existance of libph.so.1.
|
the existance of libph.so.1.
|
||||||
|
|
||||||
|
|
|
@ -830,9 +830,7 @@ query_callback (Dlg_head * h, int Par, int Msg)
|
||||||
dlg_stop (h);
|
dlg_stop (h);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case 0177:
|
|
||||||
case KEY_BACKSPACE:
|
case KEY_BACKSPACE:
|
||||||
case XCTRL ('h'):
|
|
||||||
if (end == min_end) {
|
if (end == min_end) {
|
||||||
h->ret_value = 0;
|
h->ret_value = 0;
|
||||||
dlg_stop (h);
|
dlg_stop (h);
|
||||||
|
|
23
src/key.c
23
src/key.c
|
@ -568,6 +568,23 @@ correct_key_code (int code)
|
||||||
mod |= KEY_M_CTRL;
|
mod |= KEY_M_CTRL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unrecognized 0177 is delete (preserve Ctrl) */
|
||||||
|
if (c == 0177) {
|
||||||
|
c = KEY_BACKSPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unrecognized Ctrl-d is delete */
|
||||||
|
if (c == (31 & 'd')) {
|
||||||
|
c = KEY_DC;
|
||||||
|
mod &= ~KEY_M_CTRL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unrecognized Ctrl-h is backspace */
|
||||||
|
if (c == (31 & 'h')) {
|
||||||
|
c = KEY_BACKSPACE;
|
||||||
|
mod &= ~KEY_M_CTRL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert Shift+Fn to F(n+10) */
|
/* Convert Shift+Fn to F(n+10) */
|
||||||
if (c >= KEY_F (1) && c <= KEY_F (10) && (mod & KEY_M_SHIFT)) {
|
if (c >= KEY_F (1) && c <= KEY_F (10) && (mod & KEY_M_SHIFT)) {
|
||||||
c += 10;
|
c += 10;
|
||||||
|
@ -732,13 +749,13 @@ int get_key_code (int no_delay)
|
||||||
if (parent != NULL && parent->action == MCKEY_ESCAPE) {
|
if (parent != NULL && parent->action == MCKEY_ESCAPE) {
|
||||||
/* This is just to save a lot of define_sequences */
|
/* This is just to save a lot of define_sequences */
|
||||||
if (isalpha(c)
|
if (isalpha(c)
|
||||||
|| (c == '\n') || (c == '\t') || (c == XCTRL('h'))
|
|| (c == '\n') || (c == '\t') || (c == (31 & 'h'))
|
||||||
|| (c == KEY_BACKSPACE) || (c == '!') || (c == '\r')
|
|| (c == KEY_BACKSPACE) || (c == '!') || (c == '\r')
|
||||||
|| c == 127 || c == '+' || c == '-' || c == '\\'
|
|| c == 0177 || c == '+' || c == '-' || c == '\\'
|
||||||
|| c == '?')
|
|| c == '?')
|
||||||
c = ALT(c);
|
c = ALT(c);
|
||||||
else if (isdigit(c))
|
else if (isdigit(c))
|
||||||
c = KEY_F (c-'0');
|
c = KEY_F (c - '0');
|
||||||
else if (c == ' ')
|
else if (c == ' ')
|
||||||
c = ESC_CHAR;
|
c = ESC_CHAR;
|
||||||
pending_keys = seq_append = NULL;
|
pending_keys = seq_append = NULL;
|
||||||
|
|
|
@ -1862,7 +1862,7 @@ do_search (WPanel *panel, int c_code)
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
l = strlen (panel->search_buffer);
|
l = strlen (panel->search_buffer);
|
||||||
if (l && (c_code == 8 || c_code == 0177 || c_code == KEY_BACKSPACE))
|
if (l && (c_code == KEY_BACKSPACE))
|
||||||
panel->search_buffer[--l] = 0;
|
panel->search_buffer[--l] = 0;
|
||||||
else {
|
else {
|
||||||
if (c_code && l < sizeof (panel->search_buffer)) {
|
if (c_code && l < sizeof (panel->search_buffer)) {
|
||||||
|
@ -2135,7 +2135,7 @@ panel_key (WPanel *panel, int key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not eat characters not meant for the panel below ' ' (e.g. C-l). */
|
/* Do not eat characters not meant for the panel below ' ' (e.g. C-l). */
|
||||||
if ((key >= ' '&& key <= 255) || key == 8 || key == KEY_BACKSPACE) {
|
if ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE) {
|
||||||
if (panel->searching){
|
if (panel->searching){
|
||||||
do_search (panel, key);
|
do_search (panel, key);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -600,7 +600,7 @@ static void tree_do_search (WTree *tree, int key)
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
l = strlen (tree->search_buffer);
|
l = strlen (tree->search_buffer);
|
||||||
if (l && (key == 8 || key == 0177 || key == KEY_BACKSPACE))
|
if (l && (key == KEY_BACKSPACE))
|
||||||
tree->search_buffer [--l] = 0;
|
tree->search_buffer [--l] = 0;
|
||||||
else {
|
else {
|
||||||
if (key && l < sizeof (tree->search_buffer)){
|
if (key && l < sizeof (tree->search_buffer)){
|
||||||
|
@ -976,7 +976,7 @@ tree_key (WTree *tree, int key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not eat characters not meant for the tree below ' ' (e.g. C-l). */
|
/* Do not eat characters not meant for the tree below ' ' (e.g. C-l). */
|
||||||
if ((key >= ' '&& key <= 255) || key == 8 || key == KEY_BACKSPACE) {
|
if ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE) {
|
||||||
if (tree->searching){
|
if (tree->searching){
|
||||||
tree_do_search (tree, key);
|
tree_do_search (tree, key);
|
||||||
show_tree (tree);
|
show_tree (tree);
|
||||||
|
|
|
@ -1413,15 +1413,10 @@ static const struct {
|
||||||
{ ALT('f'), forward_word },
|
{ ALT('f'), forward_word },
|
||||||
|
|
||||||
/* Editing */
|
/* Editing */
|
||||||
{ 0177, backward_delete },
|
|
||||||
{ KEY_BACKSPACE, backward_delete },
|
{ KEY_BACKSPACE, backward_delete },
|
||||||
{ XCTRL('h'), backward_delete },
|
|
||||||
{ KEY_DC, delete_char },
|
{ KEY_DC, delete_char },
|
||||||
{ XCTRL('d'), delete_char },
|
|
||||||
{ ALT('d'), kill_word },
|
{ ALT('d'), kill_word },
|
||||||
{ ALT(KEY_BACKSPACE), back_kill_word },
|
{ ALT(KEY_BACKSPACE), back_kill_word },
|
||||||
{ ALT(XCTRL('h')), back_kill_word },
|
|
||||||
{ ALT(127), back_kill_word },
|
|
||||||
|
|
||||||
/* Region manipulation */
|
/* Region manipulation */
|
||||||
{ 0, set_mark },
|
{ 0, set_mark },
|
||||||
|
|
|
@ -70,9 +70,7 @@ int check_movement_keys (int c, int additional, int page_size, void *data,
|
||||||
if (additional)
|
if (additional)
|
||||||
switch (c){
|
switch (c){
|
||||||
case 'b':
|
case 'b':
|
||||||
case XCTRL('h'):
|
|
||||||
case KEY_BACKSPACE:
|
case KEY_BACKSPACE:
|
||||||
case 0177:
|
|
||||||
(*backfn)(data, page_size-1);
|
(*backfn)(data, page_size-1);
|
||||||
return 1;
|
return 1;
|
||||||
case ' ':
|
case ' ':
|
||||||
|
|
Loading…
Reference in New Issue