diff --git a/src/ChangeLog b/src/ChangeLog index 0dec2a0b2..571c3ac22 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2003-06-09 Pavel Roskin + + * key.c (mc_bindings): Remove. Esc-">" and Esc-"<" are not + always the same as Home and End, at least in mcedit. + (get_key_code): Never ignore Escape outside known sequences. + * screen.c (panel_keymap): Add Esc-">" and Esc-"<". + * tree.c (tree_keymap): Likewise. + * widget.c (input_map): Likewise. + (listbox_key): Likewise. + (check_movement_keys): Likewise. + Reported by Miguel de Icaza + 2003-06-09 David Sterba * key.c (correct_key_code): Treat Shift-Backspace as Backspace. diff --git a/src/key.c b/src/key.c index 41a78f399..0c8496794 100644 --- a/src/key.c +++ b/src/key.c @@ -203,12 +203,6 @@ typedef const struct { int action; } key_define_t; -static key_define_t mc_bindings [] = { - { KEY_END, ESC_STR ">", MCKEY_NOACTION }, - { KEY_HOME, ESC_STR "<", MCKEY_NOACTION }, - { 0, 0, MCKEY_NOACTION }, -}; - /* Broken terminfo and termcap databases on xterminals */ static key_define_t xterm_key_defines [] = { { KEY_F(1), ESC_STR "OP", MCKEY_NOACTION }, @@ -344,8 +338,6 @@ void init_key (void) ((!strncmp (term, "iris-ansi", 9)) || (!strncmp (term, "xterm", 5)))) define_sequences (xterm_key_defines); - define_sequences (mc_bindings); - /* load some additional keys (e.g. direct Alt-? support) */ load_xtra_key_defines(); @@ -763,17 +755,15 @@ int get_key_code (int no_delay) this = this->next; else { 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 == (31 & 'h')) - || (c == KEY_BACKSPACE) || (c == '!') || (c == '\r') - || c == 0177 || c == '+' || c == '-' || c == '\\' - || c == '?') - c = ALT(c); - else if (isdigit(c)) + + /* Convert escape-digits to F-keys */ + if (isdigit(c)) c = KEY_F (c - '0'); else if (c == ' ') c = ESC_CHAR; + else + c = ALT(c); + pending_keys = seq_append = NULL; this = NULL; return correct_key_code (c); diff --git a/src/screen.c b/src/screen.c index 07df755cc..1731855d2 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2059,9 +2059,11 @@ static const key_map panel_keymap [] = { { KEY_IC, mark_file }, { KEY_HOME, move_home }, + { KEY_A1, move_home }, + { ALT ('<'), move_home }, { KEY_C1, move_end }, { KEY_END, move_end }, - { KEY_A1, move_home }, + { ALT ('>'), move_end }, { KEY_NPAGE, next_page }, { KEY_PPAGE, prev_page }, { KEY_NPAGE | KEY_M_CTRL, ctrl_next_page }, diff --git a/src/tree.c b/src/tree.c index 12ba92733..055c39213 100644 --- a/src/tree.c +++ b/src/tree.c @@ -926,9 +926,11 @@ static const key_map tree_keymap [] = { { '\n', chdir_sel }, { KEY_ENTER, chdir_sel }, { KEY_HOME, move_home }, - { KEY_C1, move_end }, - { KEY_END, move_end }, { KEY_A1, move_home }, + { ALT ('<'), move_home }, + { KEY_END, move_end }, + { KEY_C1, move_end }, + { ALT ('>'), move_end }, { KEY_NPAGE, move_nextp }, { KEY_PPAGE, move_prevp }, { XCTRL('v'), move_nextp }, diff --git a/src/widget.c b/src/widget.c index d9b96e041..4999629dd 100644 --- a/src/widget.c +++ b/src/widget.c @@ -1401,9 +1401,11 @@ static const struct { { XCTRL('a'), beginning_of_line }, { KEY_HOME, beginning_of_line }, { KEY_A1, beginning_of_line }, + { ALT ('<'), beginning_of_line }, { XCTRL('e'), end_of_line }, { KEY_END, end_of_line }, { KEY_C1, end_of_line }, + { ALT ('>'), end_of_line }, { KEY_LEFT, key_left }, { KEY_LEFT | KEY_M_CTRL, key_ctrl_left }, { XCTRL('b'), backward_char }, @@ -1926,12 +1928,14 @@ listbox_key (WListbox *l, int key) switch (key){ case KEY_HOME: case KEY_A1: + case ALT ('<'): l->current = l->top = l->list; l->pos = 0; return 1; case KEY_END: case KEY_C1: + case ALT ('>'): l->current = l->top = l->list->prev; for (i = min (l->height - 1, l->count - 1); i; i--) l->top = l->top->prev; diff --git a/src/win.c b/src/win.c index e533c96d0..c77d0845f 100644 --- a/src/win.c +++ b/src/win.c @@ -60,10 +60,12 @@ int check_movement_keys (int c, int additional, int page_size, void *data, case KEY_HOME: case KEY_A1: + case ALT ('<'): (*topfn)(data, 0); return 1; case KEY_END: case KEY_C1: + case ALT ('>'): (*bottomfn)(data, 0); return 1; }