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[] = {
|
||||
KEY_BACKSPACE, CK_BackSpace,
|
||||
0177, CK_BackSpace,
|
||||
XCTRL ('h'), CK_BackSpace,
|
||||
KEY_DC, CK_Delete,
|
||||
XCTRL ('d'), CK_Delete,
|
||||
'\n', CK_Enter,
|
||||
KEY_PPAGE, CK_Page_Up,
|
||||
KEY_NPAGE, CK_Page_Down,
|
||||
|
@ -90,10 +87,7 @@ static const long cooledit_key_map[] = {
|
|||
|
||||
static long const emacs_key_map[] = {
|
||||
KEY_BACKSPACE, CK_BackSpace,
|
||||
0177, CK_BackSpace,
|
||||
XCTRL ('h'), CK_BackSpace,
|
||||
KEY_DC, CK_Delete,
|
||||
XCTRL ('d'), CK_Delete,
|
||||
'\n', CK_Enter,
|
||||
KEY_PPAGE, CK_Page_Up,
|
||||
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 (7)), CK_Find_Again,
|
||||
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_NPAGE, CK_End_Of_Text,
|
||||
KEY_M_CTRL | KEY_HOME, CK_Beginning_Of_Text,
|
||||
|
@ -194,7 +187,6 @@ static long const common_key_map[] = {
|
|||
|
||||
/* Alt */
|
||||
KEY_M_ALT | KEY_BACKSPACE, CK_Delete_Word_Left,
|
||||
KEY_M_ALT | 0177, CK_Delete_Word_Left,
|
||||
|
||||
0, 0
|
||||
};
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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
|
||||
the existance of libph.so.1.
|
||||
|
||||
|
|
|
@ -830,9 +830,7 @@ query_callback (Dlg_head * h, int Par, int Msg)
|
|||
dlg_stop (h);
|
||||
return 1;
|
||||
|
||||
case 0177:
|
||||
case KEY_BACKSPACE:
|
||||
case XCTRL ('h'):
|
||||
if (end == min_end) {
|
||||
h->ret_value = 0;
|
||||
dlg_stop (h);
|
||||
|
|
23
src/key.c
23
src/key.c
|
@ -568,6 +568,23 @@ correct_key_code (int code)
|
|||
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) */
|
||||
if (c >= KEY_F (1) && c <= KEY_F (10) && (mod & KEY_M_SHIFT)) {
|
||||
c += 10;
|
||||
|
@ -732,13 +749,13 @@ int get_key_code (int no_delay)
|
|||
if (parent != NULL && parent->action == MCKEY_ESCAPE) {
|
||||
/* This is just to save a lot of define_sequences */
|
||||
if (isalpha(c)
|
||||
|| (c == '\n') || (c == '\t') || (c == XCTRL('h'))
|
||||
|| (c == '\n') || (c == '\t') || (c == (31 & 'h'))
|
||||
|| (c == KEY_BACKSPACE) || (c == '!') || (c == '\r')
|
||||
|| c == 127 || c == '+' || c == '-' || c == '\\'
|
||||
|| c == 0177 || c == '+' || c == '-' || c == '\\'
|
||||
|| c == '?')
|
||||
c = ALT(c);
|
||||
else if (isdigit(c))
|
||||
c = KEY_F (c-'0');
|
||||
c = KEY_F (c - '0');
|
||||
else if (c == ' ')
|
||||
c = ESC_CHAR;
|
||||
pending_keys = seq_append = NULL;
|
||||
|
|
|
@ -1862,7 +1862,7 @@ do_search (WPanel *panel, int c_code)
|
|||
int found;
|
||||
|
||||
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;
|
||||
else {
|
||||
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). */
|
||||
if ((key >= ' '&& key <= 255) || key == 8 || key == KEY_BACKSPACE) {
|
||||
if ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE) {
|
||||
if (panel->searching){
|
||||
do_search (panel, key);
|
||||
return 1;
|
||||
|
|
|
@ -600,7 +600,7 @@ static void tree_do_search (WTree *tree, int key)
|
|||
int l;
|
||||
|
||||
l = strlen (tree->search_buffer);
|
||||
if (l && (key == 8 || key == 0177 || key == KEY_BACKSPACE))
|
||||
if (l && (key == KEY_BACKSPACE))
|
||||
tree->search_buffer [--l] = 0;
|
||||
else {
|
||||
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). */
|
||||
if ((key >= ' '&& key <= 255) || key == 8 || key == KEY_BACKSPACE) {
|
||||
if ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE) {
|
||||
if (tree->searching){
|
||||
tree_do_search (tree, key);
|
||||
show_tree (tree);
|
||||
|
|
|
@ -1413,15 +1413,10 @@ static const struct {
|
|||
{ ALT('f'), forward_word },
|
||||
|
||||
/* Editing */
|
||||
{ 0177, backward_delete },
|
||||
{ KEY_BACKSPACE, backward_delete },
|
||||
{ XCTRL('h'), backward_delete },
|
||||
{ KEY_DC, delete_char },
|
||||
{ XCTRL('d'), delete_char },
|
||||
{ ALT('d'), kill_word },
|
||||
{ ALT(KEY_BACKSPACE), back_kill_word },
|
||||
{ ALT(XCTRL('h')), back_kill_word },
|
||||
{ ALT(127), back_kill_word },
|
||||
|
||||
/* Region manipulation */
|
||||
{ 0, set_mark },
|
||||
|
|
Loading…
Reference in New Issue