From 7e33c12685620a63995619df944105d243573a9b Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 25 Oct 2009 12:15:19 +0300 Subject: [PATCH] Show actual shortcuts in editor menu. Key emulation in editor was removed. Default key emulation is stored in misc/mc.keymap.default file. Emacs key emulation is stored in misc/mc.keymap.emacs. Editor options dialog was redesigned. Shortcut parser was fixed. Fixes after rebase to recent master. Signed-off-by: Andrew Borodin --- edit/edit-impl.h | 5 +- edit/edit-widget.h | 2 - edit/edit.c | 17 +-- edit/edit.h | 7 - edit/editkeys.c | 12 +- edit/editmenu.c | 262 ++++++++++------------------------- edit/editoptions.c | 61 +++------ edit/editwidget.c | 27 +++- misc/Makefile.am | 2 + misc/mc.keymap | 299 +--------------------------------------- misc/mc.keymap.default | 300 ++++++++++++++++++++++++++++++++++++++++ misc/mc.keymap.emacs | 304 +++++++++++++++++++++++++++++++++++++++++ src/keybind.c | 50 ++++--- src/screen.c | 2 +- src/setup.c | 1 - src/tty/key.c | 77 ++++++----- 16 files changed, 811 insertions(+), 617 deletions(-) mode change 100644 => 120000 misc/mc.keymap create mode 100644 misc/mc.keymap.default create mode 100644 misc/mc.keymap.emacs diff --git a/edit/edit-impl.h b/edit/edit-impl.h index 5516ed25b..0c5686661 100644 --- a/edit/edit-impl.h +++ b/edit/edit-impl.h @@ -33,6 +33,7 @@ #include #include "../src/dialog.h" /* cb_ret_t */ +#include "../src/keybind.h" /* global_keymap_t */ #include "../edit/edit.h" @@ -151,7 +152,6 @@ int edit_drop_hotkey_menu (WEdit *e, int key); void edit_menu_cmd (WEdit *e); void edit_init_menu (struct WMenuBar *menubar); cb_ret_t edit_menu_execute (int command); -void edit_reload_menu (void); void menu_save_mode_cmd (void); int edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch); int edit_get_byte (WEdit * edit, long byte_index); @@ -305,6 +305,9 @@ extern edit_stack_type edit_history_moveto [MAX_HISTORY_MOVETO]; extern WEdit *wedit; extern struct WMenuBar *edit_menubar; +extern const global_keymap_t *editor_map; +extern const global_keymap_t *editor_x_map; + extern int option_line_state_width; typedef enum { diff --git a/edit/edit-widget.h b/edit/edit-widget.h index 99b9795b1..0e908824b 100644 --- a/edit/edit-widget.h +++ b/edit/edit-widget.h @@ -126,8 +126,6 @@ struct WEdit { /* user map stuff */ GIConv converter; - const global_keymap_t *user_map; - const global_keymap_t *user_x_map; /* line break */ LineBreaks lb; diff --git a/edit/edit.c b/edit/edit.c index 3eb20cdfb..12fbf48ed 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -61,12 +61,6 @@ #include "../src/main.h" /* source_codepage */ #include "../src/learn.h" /* learn_keys */ -/* - what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL - or EDIT_KEY_EMULATION_EMACS - */ -int edit_key_emulation = EDIT_KEY_EMULATION_NORMAL; - int option_word_wrap_line_length = 72; int option_typewriter_wrap = 0; int option_auto_para_formatting = 0; @@ -123,6 +117,8 @@ const char VERTICAL_MAGIC[] = {'\1', '\1', '\1', '\1', '\n'}; * fin. */ +const global_keymap_t *editor_map; +const global_keymap_t *editor_x_map; static void user_menu (WEdit *edit); @@ -723,12 +719,13 @@ edit_purge_widget (WEdit *edit) static void edit_set_keymap (WEdit *edit) { - edit->user_map = default_editor_keymap; + editor_map = default_editor_keymap; if (editor_keymap && editor_keymap->len > 0) - edit->user_map = (global_keymap_t *) editor_keymap->data; - edit->user_x_map = default_editor_x_keymap; + editor_map = (global_keymap_t *) editor_keymap->data; + + editor_x_map = default_editor_x_keymap; if (editor_x_keymap && editor_x_keymap->len > 0) - edit->user_x_map = (global_keymap_t *) editor_x_keymap->data; + editor_x_map = (global_keymap_t *) editor_x_keymap->data; } diff --git a/edit/edit.h b/edit/edit.h index 04631c755..6beb6ef3a 100644 --- a/edit/edit.h +++ b/edit/edit.h @@ -39,10 +39,6 @@ struct WEdit; typedef struct WEdit WEdit; -#define EDIT_KEY_EMULATION_NORMAL 0 -#define EDIT_KEY_EMULATION_EMACS 1 -#define EDIT_KEY_EMULATION_USER 2 - extern int option_word_wrap_line_length; extern int option_typewriter_wrap; extern int option_auto_para_formatting; @@ -58,9 +54,6 @@ extern int option_save_position; extern int option_syntax_highlighting; extern char *option_backup_ext; -/* what editor are we going to emulate? */ -extern int edit_key_emulation; - extern int edit_confirm_save; extern int visible_tabs; diff --git a/edit/editkeys.c b/edit/editkeys.c index 6dfa149eb..6804e17ea 100644 --- a/edit/editkeys.c +++ b/edit/editkeys.c @@ -146,16 +146,16 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch) /* Commands specific to the key emulation */ if (edit->extmod) { edit->extmod = 0; - for (i = 0; edit->user_x_map[i].key; i++) { - if (x_key == edit->user_x_map[i].key) { - command = edit->user_x_map[i].command; + for (i = 0; editor_x_map[i].key; i++) { + if (x_key == editor_x_map[i].key) { + command = editor_x_map[i].command; break; } } } else { - for (i = 0; edit->user_map[i].key != 0; i++) { - if (x_key == edit->user_map[i].key) { - command = edit->user_map[i].command; + for (i = 0; editor_map[i].key != 0; i++) { + if (x_key == editor_map[i].key) { + command = editor_map[i].command; break; } } diff --git a/edit/editmenu.c b/edit/editmenu.c index fdfc452b9..0db599ab9 100644 --- a/edit/editmenu.c +++ b/edit/editmenu.c @@ -65,43 +65,20 @@ create_file_menu (void) { GList *entries = NULL; - entries = g_list_append (entries, menu_entry_create (_("&Open file..."), CK_Load)); - entries = g_list_append (entries, menu_entry_create (_("&New C-n"), CK_New)); + entries = g_list_append (entries, menu_entry_create (_("&Open file..."), CK_Load)); + entries = g_list_append (entries, menu_entry_create (_("&New"), CK_New)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Save F2"), CK_Save)); - entries = g_list_append (entries, menu_entry_create (_("Save &as... F12"), CK_Save_As)); + entries = g_list_append (entries, menu_entry_create (_("&Save"), CK_Save)); + entries = g_list_append (entries, menu_entry_create (_("Save &as..."), CK_Save_As)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Insert file... F15"), CK_Insert_File)); - entries = g_list_append (entries, menu_entry_create (_("Copy to &file... C-f"), CK_Save_Block)); + entries = g_list_append (entries, menu_entry_create (_("&Insert file..."), CK_Insert_File)); + entries = g_list_append (entries, menu_entry_create (_("Cop&y to file..."), CK_Save_Block)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&User menu... F11"), CK_User_Menu)); + entries = g_list_append (entries, menu_entry_create (_("&User menu..."), CK_User_Menu)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("A&bout... "), CK_About)); + entries = g_list_append (entries, menu_entry_create (_("A&bout..."), CK_About)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Quit F10"), CK_Quit)); - - return entries; -} - -static GList * -create_file_menu_emacs (void) -{ - GList *entries = NULL; - - entries = g_list_append (entries, menu_entry_create (_("&Open file..."), CK_Load)); - entries = g_list_append (entries, menu_entry_create (_("&New C-x k"), CK_New)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Save F2"), CK_Save)); - entries = g_list_append (entries, menu_entry_create (_("Save &as... F12"), CK_Save_As)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Insert file... F15"), CK_Insert_File)); - entries = g_list_append (entries, menu_entry_create (_("Copy to &file... "), CK_Save_Block)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&User menu... F11"), CK_User_Menu)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("A&bout... "), CK_About)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Quit F10"), CK_Quit)); + entries = g_list_append (entries, menu_entry_create (_("&Quit"), CK_Quit)); return entries; } @@ -111,59 +88,28 @@ create_edit_menu (void) { GList *entries = NULL; - entries = g_list_append (entries, menu_entry_create (_("&Toggle Mark F3"), CK_Mark)); - entries = g_list_append (entries, menu_entry_create (_("&Mark Columns S-F3"), CK_Column_Mark)); + entries = g_list_append (entries, menu_entry_create (_("&Toggle mark"), CK_Mark)); + entries = g_list_append (entries, menu_entry_create (_("&Mark columns"), CK_Column_Mark)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Toggle &ins/overw Ins"), CK_Toggle_Insert)); + entries = g_list_append (entries, menu_entry_create (_("Toggle &ins/overw"), CK_Toggle_Insert)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Copy F5"), CK_Copy)); - entries = g_list_append (entries, menu_entry_create (_("&Move F6"), CK_Move)); - entries = g_list_append (entries, menu_entry_create (_("&Delete F8"), CK_Remove)); + entries = g_list_append (entries, menu_entry_create (_("&Copy"), CK_Copy)); + entries = g_list_append (entries, menu_entry_create (_("&Move"), CK_Move)); + entries = g_list_append (entries, menu_entry_create (_("&Delete"), CK_Remove)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("C&opy to clipfile C-Ins"), CK_XStore)); - entries = g_list_append (entries, menu_entry_create (_("C&ut to clipfile S-Del"), CK_XCut)); - entries = g_list_append (entries, menu_entry_create (_("&Paste from clipfile S-Ins"), CK_XPaste)); + entries = g_list_append (entries, menu_entry_create (_("C&opy to clipfile"), CK_XStore)); + entries = g_list_append (entries, menu_entry_create (_("C&ut to clipfile"), CK_XCut)); + entries = g_list_append (entries, menu_entry_create (_("&Paste from clipfile"), CK_XPaste)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Toggle bookmar&k M-k"), CK_Toggle_Bookmark)); - entries = g_list_append (entries, menu_entry_create (_("&Next bookmark M-j"), CK_Next_Bookmark)); - entries = g_list_append (entries, menu_entry_create (_("Pre&v bookmark M-i"), CK_Prev_Bookmark)); - entries = g_list_append (entries, menu_entry_create (_("&Flush bookmark M-o"), CK_Flush_Bookmarks)); + entries = g_list_append (entries, menu_entry_create (_("Toggle bookmar&k"), CK_Toggle_Bookmark)); + entries = g_list_append (entries, menu_entry_create (_("&Next bookmark"), CK_Next_Bookmark)); + entries = g_list_append (entries, menu_entry_create (_("Pre&v bookmark"), CK_Prev_Bookmark)); + entries = g_list_append (entries, menu_entry_create (_("&Flush bookmark"), CK_Flush_Bookmarks)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Undo C-u"), CK_Undo)); + entries = g_list_append (entries, menu_entry_create (_("&Undo"), CK_Undo)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Beginning C-PgUp"), CK_Beginning_Of_Text)); - entries = g_list_append (entries, menu_entry_create (_("&End C-PgDn"), CK_End_Of_Text)); - - return entries; -} - -static GList * -create_edit_menu_emacs (void) -{ - GList *entries = NULL; - - entries = g_list_append (entries, menu_entry_create (_("&Toggle mark F3"), CK_Mark)); - entries = g_list_append (entries, menu_entry_create (_("Mar&k columns S-F3"), CK_Column_Mark)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Toggle &ins/overw Ins"), CK_Toggle_Insert)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Copy F5"), CK_Copy)); - entries = g_list_append (entries, menu_entry_create (_("&Move F6"), CK_Move)); - entries = g_list_append (entries, menu_entry_create (_("&Delete F8"), CK_Remove)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("C&opy to clipfile M-w"), CK_XStore)); - entries = g_list_append (entries, menu_entry_create (_("C&ut to clipfile C-w"), CK_XCut)); - entries = g_list_append (entries, menu_entry_create (_("&Paste from clipfile C-y"), CK_XPaste)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Toggle bookmar&k "), CK_Toggle_Bookmark)); - entries = g_list_append (entries, menu_entry_create (_("&Next bookmark "), CK_Next_Bookmark)); - entries = g_list_append (entries, menu_entry_create (_("Pre&v bookmark "), CK_Prev_Bookmark)); - entries = g_list_append (entries, menu_entry_create (_("&Flush bookmark "), CK_Flush_Bookmarks)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Undo C-u"), CK_Undo)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Beginning C-PgUp"), CK_Beginning_Of_Text)); - entries = g_list_append (entries, menu_entry_create (_("&End C-PgDn"), CK_End_Of_Text)); + entries = g_list_append (entries, menu_entry_create (_("&Beginning"), CK_Beginning_Of_Text)); + entries = g_list_append (entries, menu_entry_create (_("&End"), CK_End_Of_Text)); return entries; } @@ -173,9 +119,9 @@ create_search_replace_menu (void) { GList *entries = NULL; - entries = g_list_append (entries, menu_entry_create (_("&Search... F7"), CK_Find)); - entries = g_list_append (entries, menu_entry_create (_("Search &again F17"), CK_Find_Again)); - entries = g_list_append (entries, menu_entry_create (_("&Replace... F4"), CK_Replace)); + entries = g_list_append (entries, menu_entry_create (_("&Search..."), CK_Find)); + entries = g_list_append (entries, menu_entry_create (_("Search &again"), CK_Find_Again)); + entries = g_list_append (entries, menu_entry_create (_("&Replace..."), CK_Replace)); return entries; } @@ -185,73 +131,35 @@ create_command_menu (void) { GList *entries = NULL; - entries = g_list_append (entries, menu_entry_create (_("&Go to line... M-l"), CK_Goto)); - entries = g_list_append (entries, menu_entry_create (_("Toggle li&ne state M-n"), CK_Toggle_Line_State)); - entries = g_list_append (entries, menu_entry_create (_("Go to matching &bracket M-b"), CK_Match_Bracket)); + entries = g_list_append (entries, menu_entry_create (_("&Go to line..."), CK_Goto)); + entries = g_list_append (entries, menu_entry_create (_("Toggle li&ne state"), CK_Toggle_Line_State)); + entries = g_list_append (entries, menu_entry_create (_("Go to matching &bracket"), CK_Match_Bracket)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Find declaration A-Enter"), CK_Find_Definition)); - entries = g_list_append (entries, menu_entry_create (_("Back from declaration M--"), CK_Load_Prev_File)); - entries = g_list_append (entries, menu_entry_create (_("Forward to declaration M-+"), CK_Load_Next_File)); + entries = g_list_append (entries, menu_entry_create (_("Find declaration"), CK_Find_Definition)); + entries = g_list_append (entries, menu_entry_create (_("Back from declaration"), CK_Load_Prev_File)); + entries = g_list_append (entries, menu_entry_create (_("Forward to declaration"), CK_Load_Next_File)); #ifdef HAVE_CHARSET entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Encod&ing... M-e"), CK_SelectCodepage)); + entries = g_list_append (entries, menu_entry_create (_("Encod&ing..."), CK_SelectCodepage)); #endif entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Insert &literal... C-q"), CK_Insert_Literal)); + entries = g_list_append (entries, menu_entry_create (_("Insert &literal..."), CK_Insert_Literal)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Refresh screen C-l"), CK_Refresh)); + entries = g_list_append (entries, menu_entry_create (_("&Refresh screen"), CK_Refresh)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Start record macro C-r"), CK_Begin_Record_Macro)); - entries = g_list_append (entries, menu_entry_create (_("&Finish record macro... C-r"), CK_End_Record_Macro)); - entries = g_list_append (entries, menu_entry_create (_("&Execute macro... C-a, KEY"), CK_Execute_Macro)); - entries = g_list_append (entries, menu_entry_create (_("Delete macr&o... "), CK_Delete_Macro)); + entries = g_list_append (entries, menu_entry_create (_("&Start record macro"), CK_Begin_Record_Macro)); + entries = g_list_append (entries, menu_entry_create (_("&Finish record macro..."), CK_End_Record_Macro)); + entries = g_list_append (entries, menu_entry_create (_("&Execute macro..."), CK_Execute_Macro)); + entries = g_list_append (entries, menu_entry_create (_("Delete macr&o..."), CK_Delete_Macro)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Insert &date/time "), CK_Date)); + entries = g_list_append (entries, menu_entry_create (_("Insert &date/time"), CK_Date)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Format p&aragraph M-p"), CK_Paragraph_Format)); - entries = g_list_append (entries, menu_entry_create (_("'ispell' s&pell check C-p"), CK_Pipe_Block (1))); - entries = g_list_append (entries, menu_entry_create (_("Sor&t... M-t"), CK_Sort)); - entries = g_list_append (entries, menu_entry_create (_("Paste o&utput of... M-u"), CK_ExtCmd)); - entries = g_list_append (entries, menu_entry_create (_("E&xternal Formatter F19"), CK_Pipe_Block (0))); - entries = g_list_append (entries, menu_entry_create (_("&Mail... "), CK_Mail)); - - return entries; -} - -static GList * -create_command_menu_emacs (void) -{ - GList *entries = NULL; - - entries = g_list_append (entries, menu_entry_create (_("&Go to line... M-l"), CK_Goto)); - entries = g_list_append (entries, menu_entry_create (_("Toggle li&ne state M-n"), CK_Toggle_Line_State)); - entries = g_list_append (entries, menu_entry_create (_("Go to matching &bracket M-b"), CK_Match_Bracket)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Find declaration A-Enter"), CK_Find_Definition)); - entries = g_list_append (entries, menu_entry_create (_("Back from declaration M--"), CK_Load_Prev_File)); - entries = g_list_append (entries, menu_entry_create (_("Forward to declaration M-+"), CK_Load_Next_File)); -#ifdef HAVE_CHARSET - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Encod&ing... C-t"), CK_SelectCodepage)); -#endif - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Insert &literal... C-q"), CK_Insert_Literal)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Refresh screen C-l"), CK_Refresh)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("&Start record macro C-r"), CK_Begin_Record_Macro)); - entries = g_list_append (entries, menu_entry_create (_("&Finish record macro... C-r"), CK_End_Record_Macro)); - entries = g_list_append (entries, menu_entry_create (_("&Execute macro... C-x e, KEY"), CK_Execute_Macro)); - entries = g_list_append (entries, menu_entry_create (_("Delete macr&o... "), CK_Delete_Macro)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Insert &date/time "), CK_Date)); - entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Format p&aragraph M-p"), CK_Paragraph_Format)); - entries = g_list_append (entries, menu_entry_create (_("'ispell' s&pell check M-$"), CK_Pipe_Block (1))); - entries = g_list_append (entries, menu_entry_create (_("Sor&t... M-t"), CK_Sort)); - entries = g_list_append (entries, menu_entry_create (_("Paste o&utput of... M-u"), CK_ExtCmd)); - entries = g_list_append (entries, menu_entry_create (_("E&xternal Formatter F19"), CK_Pipe_Block (0))); - entries = g_list_append (entries, menu_entry_create (_("&Mail... "), CK_Mail)); + entries = g_list_append (entries, menu_entry_create (_("Format p&aragraph"), CK_Paragraph_Format)); + entries = g_list_append (entries, menu_entry_create (_("'ispell' s&pell check"), CK_Pipe_Block (1))); + entries = g_list_append (entries, menu_entry_create (_("Sor&t..."), CK_Sort)); + entries = g_list_append (entries, menu_entry_create (_("Paste o&utput of..."), CK_ExtCmd)); + entries = g_list_append (entries, menu_entry_create (_("E&xternal formatter"), CK_Pipe_Block (0))); + entries = g_list_append (entries, menu_entry_create (_("&Mail..."), CK_Mail)); return entries; } @@ -262,86 +170,54 @@ create_options_menu (void) GList *entries = NULL; entries = g_list_append (entries, menu_entry_create (_("&General... "), CK_Edit_Options)); - entries = g_list_append (entries, menu_entry_create (_("&Save mode..."), CK_Edit_Save_Mode)); - entries = g_list_append (entries, menu_entry_create (_("Learn &Keys..."), CK_LearnKeys)); - entries = g_list_append (entries, menu_entry_create (_("Syntax &Highlighting..."), CK_Choose_Syntax)); + entries = g_list_append (entries, menu_entry_create (_("Save &mode..."), CK_Edit_Save_Mode)); + entries = g_list_append (entries, menu_entry_create (_("Learn &keys..."), CK_LearnKeys)); + entries = g_list_append (entries, menu_entry_create (_("Syntax &highlighting..."), CK_Choose_Syntax)); entries = g_list_append (entries, menu_separator_create ()); entries = g_list_append (entries, menu_entry_create (_("S&yntax file"), CK_Load_Syntax_File)); entries = g_list_append (entries, menu_entry_create (_("&Menu file"), CK_Load_Menu_File)); entries = g_list_append (entries, menu_separator_create ()); - entries = g_list_append (entries, menu_entry_create (_("Save setu&p..."), CK_SaveSetupCmd)); + entries = g_list_append (entries, menu_entry_create (_("&Save setup"), CK_SaveSetupCmd)); return entries; } -static void -edit_init_menu_normal (struct WMenuBar *menubar) -{ - menubar_add_menu (menubar, create_menu (_(" &File "), create_file_menu (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Edit "), create_edit_menu (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Sear/Repl "), create_search_replace_menu (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Command "), create_command_menu (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Options "), create_options_menu (), "[Internal File Editor]")); -} - -static void -edit_init_menu_emacs (struct WMenuBar *menubar) -{ - menubar_add_menu (menubar, create_menu (_(" &File "), create_file_menu_emacs (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Edit "), create_edit_menu_emacs (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Sear/Repl "), create_search_replace_menu (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Command "), create_command_menu_emacs (), "[Internal File Editor]")); - menubar_add_menu (menubar, create_menu (_(" &Options "), create_options_menu (), "[Internal File Editor]")); -} - void edit_init_menu (struct WMenuBar *menubar) { - switch (edit_key_emulation) { - default: - case EDIT_KEY_EMULATION_NORMAL: - edit_init_menu_normal (menubar); - break; - case EDIT_KEY_EMULATION_EMACS: - edit_init_menu_emacs (menubar); - break; - } + menubar_add_menu (menubar, create_menu (_("&File"), create_file_menu (), "[Internal File Editor]")); + menubar_add_menu (menubar, create_menu (_("&Edit"), create_edit_menu (), "[Internal File Editor]")); + menubar_add_menu (menubar, create_menu (_("&Search"), create_search_replace_menu (), "[Internal File Editor]")); + menubar_add_menu (menubar, create_menu (_("&Command"), create_command_menu (), "[Internal File Editor]")); + menubar_add_menu (menubar, create_menu (_("&Options"), create_options_menu (), "[Internal File Editor]")); } -void -edit_reload_menu (void) -{ - menubar_set_menu (edit_menubar, NULL); - edit_init_menu (edit_menubar); -} - - static void edit_drop_menu_cmd (WEdit *e, int which) { - if (edit_menubar->is_active) - return; - edit_menubar->is_active = TRUE; - edit_menubar->is_dropped = (drop_menus != 0); - if (which >= 0) - edit_menubar->selected = which; + if (!edit_menubar->is_active) { + edit_menubar->is_active = TRUE; + edit_menubar->is_dropped = (drop_menus != 0); + if (which >= 0) + edit_menubar->selected = which; - edit_menubar->previous_widget = e->widget.parent->current->dlg_id; - dlg_select_widget (edit_menubar); + edit_menubar->previous_widget = e->widget.parent->current->dlg_id; + dlg_select_widget (edit_menubar); + } } -void edit_menu_cmd (WEdit * e) +void +edit_menu_cmd (WEdit *e) { edit_drop_menu_cmd (e, -1); } -int edit_drop_hotkey_menu (WEdit * e, int key) +int +edit_drop_hotkey_menu (WEdit *e, int key) { int m = 0; switch (key) { case ALT ('f'): - if (edit_key_emulation == EDIT_KEY_EMULATION_EMACS) - return 0; m = 0; break; case ALT ('e'): diff --git a/edit/editoptions.c b/edit/editoptions.c index fbf0a3a55..bb1e81f7c 100644 --- a/edit/editoptions.c +++ b/edit/editoptions.c @@ -38,16 +38,8 @@ #include "../src/wtools.h" /* QuickDialog */ #include "../src/main.h" /* option_tab_spacing */ -#define OPT_DLG_H 21 -#define OPT_DLG_W 72 - -static const char *key_emu_str[] = -{ - N_("Intuitive"), - N_("Emacs"), - N_("User-defined"), - NULL -}; +#define OPT_DLG_H 16 +#define OPT_DLG_W 74 static const char *wrap_str[] = { @@ -72,44 +64,42 @@ edit_options_dialog (void) char wrap_length[16], tab_spacing[16], *p, *q; int wrap_mode = 0; int old_syntax_hl; - int tedit_key_emulation = edit_key_emulation; QuickWidget quick_widgets[] = { /* 0 */ QUICK_BUTTON (6, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&Cancel"), B_CANCEL, NULL), /* 1 */ QUICK_BUTTON (2, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&OK"), B_ENTER, NULL), - /* 2 */ QUICK_LABEL (OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 6, OPT_DLG_H, N_("Word wrap line length: ")), - /* 3 */ QUICK_INPUT (OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 6, OPT_DLG_H, + /* 2 */ QUICK_LABEL (OPT_DLG_W / 2 + 1, OPT_DLG_W, 11, OPT_DLG_H, + N_("Word wrap line length: ")), + /* 3 */ QUICK_INPUT (OPT_DLG_W / 2 + 25, OPT_DLG_W, 11, OPT_DLG_H, wrap_length, OPT_DLG_W / 2 - 4 - 24, 0, "edit-word-wrap", &p), - /* 4 */ QUICK_LABEL (OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H, N_("Tab spacing: ")), - /* 5 */ QUICK_INPUT (OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H, - tab_spacing, OPT_DLG_W / 2 - 4 - 24, 0, "edit-tab-spacing", &q), - /* 6 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 8, OPT_DLG_H, + /* 4 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 10, OPT_DLG_H, N_("Cursor beyond end of line"), &option_cursor_beyond_eol), - /* 7 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 9, OPT_DLG_H, + /* 5 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 9, OPT_DLG_H, N_("Pers&istent selection"), &option_persistent_selections), - /* 8 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 10, OPT_DLG_H, + /* 6 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 8, OPT_DLG_H, N_("Synta&x highlighting"), &option_syntax_highlighting), - /* 9 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 11, OPT_DLG_H, + /* 7 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 7, OPT_DLG_H, N_("Visible tabs"), &visible_tabs), - /* 10 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 12, OPT_DLG_H, + /* 8 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 6, OPT_DLG_H, N_("Visible trailing spaces"), &visible_tws), - /* 11 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 13, OPT_DLG_H, + /* 9 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 5, OPT_DLG_H, N_("Save file &position"), &option_save_position), - /* 12 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 14, OPT_DLG_H, + /* 10 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 4, OPT_DLG_H, N_("Confir&m before saving"), &edit_confirm_save), - /* 13 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 15, OPT_DLG_H, - N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces), - /* 14 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 16, OPT_DLG_H, + /* 11 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 3, OPT_DLG_H, N_("&Return does autoindent"), &option_return_does_auto_indent), - /* 15 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 17, OPT_DLG_H, + /* 12 */ QUICK_LABEL (3, OPT_DLG_W, 11, OPT_DLG_H, N_("Tab spacing: ")), + /* 13 */ QUICK_INPUT (3 + 24, OPT_DLG_W, 11, OPT_DLG_H, + tab_spacing, OPT_DLG_W / 2 - 4 - 24, 0, "edit-tab-spacing", &q), + /* 14 */ QUICK_CHECKBOX (3, OPT_DLG_W, 10, OPT_DLG_H, + N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces), + /* 15 */ QUICK_CHECKBOX (3, OPT_DLG_W, 9, OPT_DLG_H, N_("&Backspace through tabs"), &option_backspace_through_tabs), - /* 16 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 18, OPT_DLG_H, + /* 16 */ QUICK_CHECKBOX (3, OPT_DLG_W, 8, OPT_DLG_H, N_("&Fake half tabs"), &option_fake_half_tabs), - /* 17 */ QUICK_RADIO (5, OPT_DLG_W, OPT_DLG_H - 11, OPT_DLG_H, 3, wrap_str, &wrap_mode), - /* 18 */ QUICK_LABEL (4, OPT_DLG_W, OPT_DLG_H - 12, OPT_DLG_H, N_("Wrap mode")), - /* 19 */ QUICK_RADIO (5, OPT_DLG_W, OPT_DLG_H - 17, OPT_DLG_H, 3, key_emu_str, &tedit_key_emulation), - /* 10 */ QUICK_LABEL (4, OPT_DLG_W, OPT_DLG_H - 18, OPT_DLG_H, N_("Key emulation")), + /* 17 */ QUICK_RADIO (4, OPT_DLG_W, 4, OPT_DLG_H, 3, wrap_str, &wrap_mode), + /* 18 */ QUICK_LABEL (3, OPT_DLG_W, 3, OPT_DLG_H, N_("Wrap mode")), QUICK_END }; @@ -123,7 +113,6 @@ edit_options_dialog (void) static gboolean i18n_flag = FALSE; if (!i18n_flag) { - i18n_translate_array (key_emu_str); i18n_translate_array (wrap_str); i18n_flag = TRUE; } @@ -168,12 +157,6 @@ edit_options_dialog (void) option_typewriter_wrap = 0; } - /* Reload menu if key emulation has changed */ - if (edit_key_emulation != tedit_key_emulation) { - edit_key_emulation = tedit_key_emulation; - edit_reload_menu (); - } - /* Load or unload syntax rules if the option has changed */ if (option_syntax_highlighting != old_syntax_hl) edit_load_syntax (wedit, NULL, option_syntax_type); diff --git a/edit/editwidget.c b/edit/editwidget.c index 2b37d9b2b..151270e24 100644 --- a/edit/editwidget.c +++ b/edit/editwidget.c @@ -49,6 +49,7 @@ #include "../src/widget.h" /* buttonbar_redraw() */ #include "../src/menu.h" /* menubar_new() */ +#include "../src/cmddef.h" WEdit *wedit; struct WMenuBar *edit_menubar; @@ -57,6 +58,26 @@ int column_highlighting = 0; static cb_ret_t edit_callback (Widget *, widget_msg_t msg, int parm); +static char * +edit_get_shortcut (int command) +{ + const char *ext_map; + const char *shortcut = NULL; + + ext_map = lookup_keymap_shortcut (editor_map, CK_Ext_Mode); + + if (ext_map != NULL) + shortcut = lookup_keymap_shortcut (editor_x_map, command); + if (shortcut != NULL) + return g_strdup_printf ("%s %s", ext_map, shortcut); + + shortcut = lookup_keymap_shortcut (editor_map, command); + if (shortcut != NULL) + return g_strdup (shortcut); + + return NULL; +} + static int edit_event (Gpm_Event *event, void *data) { @@ -189,9 +210,10 @@ edit_file (const char *_file, int line) g_free (dir); } - if (!(wedit = edit_init (NULL, LINES - 2, COLS, _file, line))) { + wedit = edit_init (NULL, LINES - 2, COLS, _file, line); + + if (wedit == NULL) return 0; - } /* Create a new dialog and add it widgets to it */ edit_dlg = @@ -209,6 +231,7 @@ edit_file (const char *_file, int line) add_widget (edit_dlg, wedit); edit_dlg->menu_executor = edit_menu_execute; + edit_dlg->get_shortcut = edit_get_shortcut; edit_menubar = menubar_new (0, 0, COLS, NULL); add_widget (edit_dlg, edit_menubar); edit_init_menu (edit_menubar); diff --git a/misc/Makefile.am b/misc/Makefile.am index 28a25994b..527678d62 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -15,6 +15,8 @@ LIBFILES_CONST = \ mc.lib \ filehighlight.ini \ mc.keymap \ + mc.keymap.default \ + mc.keymap.emacs \ mc.menu \ mc.menu.sr diff --git a/misc/mc.keymap b/misc/mc.keymap deleted file mode 100644 index 5638bb4d4..000000000 --- a/misc/mc.keymap +++ /dev/null @@ -1,298 +0,0 @@ -[editor] -EditXStore = -EditXPaste = -EditXCut = - -EditDeleteLine = ctrl-y -EditDeleteToLineEnd = ctrl-k -EditDeleteToLineBegin = - -EditLeft = left -EditRight = right -EditUp = up -EditDown = down -EditEnter = enter -EditReturn = -EditBackSpace = backspace -EditDelete = delete -EditPageUp = pgup -EditPageDown = pgdn -EditWordLeft = ctrl-left -EditWordRight = ctrl-right -EditHome = home -EditEnd = end -EditTab = tab -EditUndo = ctrl-u -EditBeginningOfText = ctrl-pgup -EditEndOfText = ctrl-pgdn -EditScrollUp = ctrl-up -EditScrollDown = ctrl-down -EditBeginPage = ctrl-home -EditEndPage = ctrl-end -EditDeleteWordLeft = alt-backspace -EditDeleteWordRight = alt-d -EditParagraphUp = -EditParagraphDown = -EditSave = f2 -EditLoad = -EditNew = -EditSaveas = f12 -EditMark = f3 -EditCopy = f5 -EditMove = f6 -EditRemove = f8 -EditUnmark = -EditFind = f7 - -EditPageUpHighlight = shift-pgup -EditPageDownHighlight = shift-pgdn -EditLeftHighlight = shift-left -EditRightHighlight = shift-right -EditWordLeftHighlight = ctrl-shift-left -EditWordRightHighlight = ctrl-shift-right -EditUpHighlight = shift-up -EditDownHighlight = shift-down -EditHomeHighlight = shift-home -EditEndHighlight = shift-end -EditBeginningOfTextHighlight = ctrl-shift-home -EditEndOfTextHighlight = ctrl-shift-end -EditBeginPageHighlight = ctrl-shift-pgup -EditEndPageHighlight = ctrl-shift-pgdn -EditScrollUpHighlight = -EditScrollDownHighlight = -EditParagraphUpHighlight = -EditParagraphDownHighlight = - -EditPageUpAltHighlight = alt-pgup -EditPageDownAltHighlight = alt-pgdn -EditLeftAltHighlight = alt-left -EditRightAltHighlight = alt-right -EditWordLeftAltHighlight = ctrl-alt-left -EditWordRightAltHighlight = ctrl-alt-right -EditUpAltHighlight = alt-up -EditDownAltHighlight = alt-down -EditHomeAltHighlight = alt-home -EditEndAltHighlight = alt-end -EditBeginningOfTextAltHighlight = ctrl-alt-home -EditEndOfTextHighlight = ctrl-alt-end -EditBeginPageHighlight = ctrl-alt-pgup -EditEndPageAltHighlight = ctrl-alt-pgdn -EditScrollUpAltHighlight = -EditScrollDownAltHighlight = -EditParagraphUpAltHighlight = -EditParagraphDownAltHighlight = - -EditSaveBlock = ctrl-f -EditColumnMark = f13 -EditFindAgain = f17 -EditReplace = f4 -EditReplaceAgain = f14 -EditCompleteWord = alt-tab -EditDebugStart = -EditDebugStop = -EditDebugToggleBreak = -EditDebugClear = -EditDebugNext = -EditDebugStep = -EditDebugBackTrace = -EditDebugContinue = -EditDebugEnterCommand = -EditDebugUntilCurser = -EditInsertFile = f15 -EditQuit = f10 -EditToggleInsert = ins -EditHelp = f1 -EditDate = -EditRefresh = ctrl-l -EditGoto = alt-l -EditManPage = -EditSort = alt-t -EditMail = -EditCancel = -EditComplete = - -EditParagraphFormat = alt-p -EditUtil = -EditTypeLoadPython = -EditFindFile = -EditCtags = -EditMatchBracket = alt-b -EditTerminal = -EditTerminalApp = -EditExtCmd = alt-u -EditUserMenu = f11 -EditSaveDesktop = -EditNewWindow = -EditCycle = -EditMenu = f9 -EditSaveAndQuit = -EditRunAnother = -EditCheckSaveAndQuit = -EditMaximize = -EditDeleteMacro = -EditToggleBookmark = alt-k -EditFlushBookmarks = alt-o -EditNextBookmark = alt-j -EditPrevBookmark = alt-i - -EditSelectionHistory = -EditShell = ctrl-o -EditInsertLiteral = ctrl-q -EditExecuteMacro = ctrl-a -EditBeginorEndMacro = ctrl-r -EditBeginRecordMacro = -EditEndRecordMacro = -EditToggleLineState = alt-n -EditToggleTabTWS = alt-underline -EditToggleSyntax = ctrl-s - -EditFindDefinition = alt-enter -EditLoadPrevFile = alt-minus -EditLoadNextFile = alt-equal - -SelectCodepage = alt-e - -[viewer] -ViewSearch = question; slash; f7 -ViewContinueSearch = ctrl-r; ctrl-s; f17 -ViewMoveToBol = home -ViewMoveToEol = end -ViewMoveLeft = h; left -ViewMoveRight = l; right -ViewMoveUp = k; y; insert; up -ViewMoveDown = j; e; delete; down -ViewMovePgDn = f; space; pgdn -ViewMovePgUp = b; pgup -ViewMoveHalfPgDn = d -ViewMoveHalfPgUp = u -ViewGotoBookmark = m -ViewNewBookmark = r -ViewNextFile = ctrl-f -ViewPrevFile = ctrl-b -ViewQuit = q; esc -SelectCodepage = alt-e -ShowCommandLine = ctrl-o -ViewToggleRuler = alt-r - -[viewer:hex] -HexViewToggleNavigationMode = tab -ViewMoveToBol = ctrl-a; home -ViewMoveToEol = ctrl-e; end -ViewMoveLeft = b; left -ViewMoveRight = f; right -ViewMoveUp = k; y; up -ViewMoveDown = j; delete; down - -[main] -CmdUserMenu = f2 -CmdView = f3 -CmdViewFile = f13 -CmdEdit = f4 -CmdCopy = f5 -CmdRename = f6 -CmdMkdir = f7 -CmdDelete = f8 -CmdQuit = f10 -CmdMenuLastSelected = f19 -CmdQuietQuit = f20 -CmdFind = alt-question -CmdQuickCd = alt-c -CmdQuickChdir = ctrl-backslash -CmdReread = ctrl-r -CmdSingleDirsize = ctrl-space -CmdSuspend = ctrl-z -CmdSwapPanel = ctrl-u -CmdHistory = alt-h -CmdToggleListing = alt-t -CmdToggleShowHidden = alt-dot -ShowCommandLine = ctrl-o -CmdCopyCurrentPathname = alt-a -CmdCopyOtherPathname = alt-shift-a -CmdFilteredView = alt-exclamation -CmdSelect = kpplus -CmdUnselect = kpminus -CmdReverseSelection = alt-kpasterisk -ExtMap1 = ctrl-x - -[main:xmap] -CmdChmod = c -CmdChown = o -CmdCompareDirs = d -CmdEditSymlink = ctrl-s -CmdLink = l -CmdSymlink = s -CmdMenuInfo = i -CmdMenuQuickView = q -CmdExternalPanelize = exclamation -CmdReselectVfs = a -CmdJobs = j - -[panel] -PanelStartSearch = ctrl-s; alt-s -PanelMarkFile = ins; ctrl-t -PanelMoveDown = down; ctrl-n -PanelMoveUp = up; ctrl-p -PanelMoveLeft = left -PanelMoveRight = right -PanelPrevPage = pgup; alt-v -PanelNextPage = pgdn; ctrl-v -PanelDoEnter = enter -PanelChdirOtherPanel = alt-o -PanelChdirToReadlink = alt-l -PanelViewSimple = F13 -PanelEditNew = F14 -PanelCopyLocal = F15 -PanelRenameLocal = F16 -PanelDeleteLocal = F18 -PanelReverseSelection = alt-asterisk -PanelSelect = alt-plus -PanelUnselect = alt-minus -PanelCtrlNextPage = ctrl-pgdn -PanelCtrlPrevPage = ctrl-pgup -PanelDirectoryHistoryList = alt-shift-h -PanelDirectoryHistoryNext = alt-u -PanelDirectoryHistoryPrev = alt-y -PanelGotoBottomFile = alt-j -PanelGotoMiddleFile = alt-r -PanelSyncOtherPanel = alt-i -PanelGotoTopFile = alt-g -PanelSetPanelEncoding = alt-e -PanelMoveHome = alt-lt; home -PanelMoveEnd = alt-gt; end -PanelSelectSortOrder= -PanelToggleSortOrderPrev= -PanelToggleSortOrderNext= -PanelReverseSort= -PanelSortOrderByName= -PanelSortOrderByExt= -PanelSortOrderBySize= -PanelSortOrderByMTime= - - -[panel:xmap] - -[input] -InputBol = ctrl-a; alt-lt; home -InputEol = ctrl-e; alt-gt; end -InputMoveLeft = left; alt-left -InputWordLeft = ctrl-left -InputBackwardChar = ctrl-b -InputBackwardWord = alt-b -InputMoveRight = right; alt-right -InputWordRight = ctrl-right -InputForwardChar = ctrl-f -InputForwardWord = alt-f - -InputBackwardDelete = backspace -InputDeleteChar = delete -InputKillWord = alt-d -InputBackwardKillWord = alt-backspace -InputSetMark = -InputKillRegion = ctrl-w -InputKillSave = alt-w -InputYank = ctrl-y -InputKillLine = ctrl-k -InputHistoryPrev = alt-p; ctrl-down -InputHistoryNext = alt-n; ctrl-up -InputHistoryShow = alt-h -InputComplete = alt-tab diff --git a/misc/mc.keymap b/misc/mc.keymap new file mode 120000 index 000000000..f73fea290 --- /dev/null +++ b/misc/mc.keymap @@ -0,0 +1 @@ +mc.keymap.default \ No newline at end of file diff --git a/misc/mc.keymap.default b/misc/mc.keymap.default new file mode 100644 index 000000000..6c29f9f2b --- /dev/null +++ b/misc/mc.keymap.default @@ -0,0 +1,300 @@ +[editor] +EditXStore = ctrl-insert +EditXPaste = shift-insert +EditXCut = shift-delete + +EditDeleteLine = ctrl-y +EditDeleteToLineEnd = ctrl-k +EditDeleteToLineBegin = + +EditLeft = left +EditRight = right +EditUp = up +EditDown = down +EditEnter = enter +EditReturn = +EditBackSpace = backspace +EditDelete = delete +EditPageUp = pgup +EditPageDown = pgdn +EditWordLeft = ctrl-left +EditWordRight = ctrl-right +EditHome = home +EditEnd = end +EditTab = tab +EditUndo = ctrl-u +EditBeginningOfText = ctrl-pgup +EditEndOfText = ctrl-pgdn +EditScrollUp = ctrl-up +EditScrollDown = ctrl-down +EditBeginPage = ctrl-home +EditEndPage = ctrl-end +EditDeleteWordLeft = alt-backspace +EditDeleteWordRight = alt-d +EditParagraphUp = +EditParagraphDown = +EditSave = f2 +EditLoad = +EditNew = ctrl-n +EditSaveas = f12 +EditMark = f3 +EditCopy = f5 +EditMove = f6 +EditRemove = f8 +EditUnmark = +EditFind = f7 + +EditPageUpHighlight = shift-pgup +EditPageDownHighlight = shift-pgdn +EditLeftHighlight = shift-left +EditRightHighlight = shift-right +EditWordLeftHighlight = ctrl-shift-left +EditWordRightHighlight = ctrl-shift-right +EditUpHighlight = shift-up +EditDownHighlight = shift-down +EditHomeHighlight = shift-home +EditEndHighlight = shift-end +EditBeginningOfTextHighlight = ctrl-shift-home +EditEndOfTextHighlight = ctrl-shift-end +EditBeginPageHighlight = ctrl-shift-pgup +EditEndPageHighlight = ctrl-shift-pgdn +EditScrollUpHighlight = +EditScrollDownHighlight = +EditParagraphUpHighlight = +EditParagraphDownHighlight = + +EditPageUpAltHighlight = alt-pgup +EditPageDownAltHighlight = alt-pgdn +EditLeftAltHighlight = alt-left +EditRightAltHighlight = alt-right +EditWordLeftAltHighlight = ctrl-alt-left +EditWordRightAltHighlight = ctrl-alt-right +EditUpAltHighlight = alt-up +EditDownAltHighlight = alt-down +EditHomeAltHighlight = alt-home +EditEndAltHighlight = alt-end +EditBeginningOfTextAltHighlight = ctrl-alt-home +EditEndOfTextHighlight = ctrl-alt-end +EditBeginPageHighlight = ctrl-alt-pgup +EditEndPageAltHighlight = ctrl-alt-pgdn +EditScrollUpAltHighlight = +EditScrollDownAltHighlight = +EditParagraphUpAltHighlight = +EditParagraphDownAltHighlight = + +EditSaveBlock = ctrl-f +EditColumnMark = f13 +EditFindAgain = f17 +EditReplace = f4 +EditReplaceAgain = f14 +EditCompleteWord = alt-tab +EditDebugStart = +EditDebugStop = +EditDebugToggleBreak = +EditDebugClear = +EditDebugNext = +EditDebugStep = +EditDebugBackTrace = +EditDebugContinue = +EditDebugEnterCommand = +EditDebugUntilCurser = +EditInsertFile = f15 +EditQuit = f10 +EditToggleInsert = insert +EditHelp = f1 +EditDate = +EditRefresh = ctrl-l +EditGoto = alt-l +EditManPage = +EditSort = alt-t +EditMail = +EditCancel = +EditComplete = + +EditParagraphFormat = alt-p +EditUtil = +EditTypeLoadPython = +EditFindFile = +EditCtags = +EditMatchBracket = alt-b +EditTerminal = +EditTerminalApp = +EditExtCmd = alt-u +EditUserMenu = f11 +EditSaveDesktop = +EditNewWindow = +EditCycle = +EditMenu = f9 +EditSaveAndQuit = +EditRunAnother = +EditCheckSaveAndQuit = +EditMaximize = +EditToggleBookmark = alt-k +EditFlushBookmarks = alt-o +EditNextBookmark = alt-j +EditPrevBookmark = alt-i + +EditSelectionHistory = +EditShell = ctrl-o +EditInsertLiteral = ctrl-q + +EditBeginRecordMacro = ctrl-r +EditEndRecordMacro = ctrl-r +EditBeginOrEndMacro = ctrl-r +EditExecuteMacro = ctrl-a +EditDeleteMacro = + +EditToggleLineState = alt-n +EditToggleTabTWS = alt-underline +EditToggleSyntax = ctrl-s + +EditFindDefinition = alt-enter +EditLoadPrevFile = alt-minus +EditLoadNextFile = alt-plus + +SelectCodepage = alt-e + +[viewer] +ViewSearch = question; slash; f7 +ViewContinueSearch = ctrl-r; ctrl-s; f17 +ViewMoveToBol = home +ViewMoveToEol = end +ViewMoveLeft = h; left +ViewMoveRight = l; right +ViewMoveUp = k; y; insert; up +ViewMoveDown = j; e; delete; down +ViewMovePgDn = f; space; pgdn +ViewMovePgUp = b; pgup +ViewMoveHalfPgDn = d +ViewMoveHalfPgUp = u +ViewGotoBookmark = m +ViewNewBookmark = r +ViewNextFile = ctrl-f +ViewPrevFile = ctrl-b +ViewQuit = q; esc +SelectCodepage = alt-e +ShowCommandLine = ctrl-o +ViewToggleRuler = alt-r + +[viewer:hex] +HexViewToggleNavigationMode = tab +ViewMoveToBol = ctrl-a; home +ViewMoveToEol = ctrl-e; end +ViewMoveLeft = b; left +ViewMoveRight = f; right +ViewMoveUp = k; y; up +ViewMoveDown = j; delete; down + +[main] +CmdUserMenu = f2 +CmdView = f3 +CmdViewFile = f13 +CmdEdit = f4 +CmdCopy = f5 +CmdRename = f6 +CmdMkdir = f7 +CmdDelete = f8 +CmdQuit = f10 +CmdMenuLastSelected = f19 +CmdQuietQuit = f20 +CmdFind = alt-question +CmdQuickCd = alt-c +CmdQuickChdir = ctrl-backslash +CmdReread = ctrl-r +CmdSingleDirsize = ctrl-space +CmdSuspend = ctrl-z +CmdSwapPanel = ctrl-u +CmdHistory = alt-h +CmdToggleListing = alt-t +CmdToggleShowHidden = alt-dot +ShowCommandLine = ctrl-o +CmdCopyCurrentPathname = alt-a +CmdCopyOtherPathname = alt-shift-a +CmdFilteredView = alt-exclamation +CmdSelect = kpplus +CmdUnselect = kpminus +CmdReverseSelection = alt-kpasterisk +ExtMap1 = ctrl-x + +[main:xmap] +CmdChmod = c +CmdChown = o +CmdCompareDirs = d +CmdEditSymlink = ctrl-s +CmdLink = l +CmdSymlink = s +CmdMenuInfo = i +CmdMenuQuickView = q +CmdExternalPanelize = exclamation +CmdReselectVfs = a +CmdJobs = j + +[panel] +PanelStartSearch = ctrl-s; alt-s +PanelMarkFile = insert; ctrl-t +PanelMoveDown = down; ctrl-n +PanelMoveUp = up; ctrl-p +PanelMoveLeft = left +PanelMoveRight = right +PanelPrevPage = pgup; alt-v +PanelNextPage = pgdn; ctrl-v +PanelDoEnter = enter +PanelChdirOtherPanel = alt-o +PanelChdirToReadlink = alt-l +PanelViewSimple = F13 +PanelEditNew = F14 +PanelCopyLocal = F15 +PanelRenameLocal = F16 +PanelDeleteLocal = F18 +PanelReverseSelection = alt-asterisk +PanelSelect = alt-plus +PanelUnselect = alt-minus +PanelCtrlNextPage = ctrl-pgdn +PanelCtrlPrevPage = ctrl-pgup +PanelDirectoryHistoryList = alt-shift-h +PanelDirectoryHistoryNext = alt-u +PanelDirectoryHistoryPrev = alt-y +PanelGotoBottomFile = alt-j +PanelGotoMiddleFile = alt-r +PanelSyncOtherPanel = alt-i +PanelGotoTopFile = alt-g +PanelSetPanelEncoding = alt-e +PanelMoveHome = alt-lt; home +PanelMoveEnd = alt-gt; end +PanelSelectSortOrder= +PanelToggleSortOrderPrev= +PanelToggleSortOrderNext= +PanelReverseSort= +PanelSortOrderByName= +PanelSortOrderByExt= +PanelSortOrderBySize= +PanelSortOrderByMTime= + + +[panel:xmap] + +[input] +InputBol = ctrl-a; alt-lt; home +InputEol = ctrl-e; alt-gt; end +InputMoveLeft = left; alt-left +InputWordLeft = ctrl-left +InputBackwardChar = ctrl-b +InputBackwardWord = alt-b +InputMoveRight = right; alt-right +InputWordRight = ctrl-right +InputForwardChar = ctrl-f +InputForwardWord = alt-f + +InputBackwardDelete = backspace +InputDeleteChar = delete +InputKillWord = alt-d +InputBackwardKillWord = alt-backspace +InputSetMark = +InputKillRegion = ctrl-w +InputKillSave = alt-w +InputYank = ctrl-y +InputKillLine = ctrl-k +InputHistoryPrev = alt-p; ctrl-down +InputHistoryNext = alt-n; ctrl-up +InputHistoryShow = alt-h +InputComplete = alt-tab diff --git a/misc/mc.keymap.emacs b/misc/mc.keymap.emacs new file mode 100644 index 000000000..a9fcf0127 --- /dev/null +++ b/misc/mc.keymap.emacs @@ -0,0 +1,304 @@ +[editor] +EditXStore = meta-w +EditXPaste = ctrl-y +EditXCut = ctrl-w + +EditDeleteLine = ctrl-y +EditDeleteToLineEnd = ctrl-k +EditDeleteToLineBegin = + +EditLeft = left +EditRight = right +EditUp = up +EditDown = down +EditEnter = enter +EditReturn = +EditBackSpace = backspace +EditDelete = delete +EditPageUp = pgup +EditPageDown = pgdn +EditWordLeft = ctrl-left +EditWordRight = ctrl-right +EditHome = home +EditEnd = end +EditTab = tab +EditUndo = ctrl-u +EditBeginningOfText = ctrl-pgup +EditEndOfText = ctrl-pgdn +EditScrollUp = ctrl-up +EditScrollDown = ctrl-down +EditBeginPage = ctrl-home +EditEndPage = ctrl-end +EditDeleteWordLeft = alt-backspace +EditDeleteWordRight = alt-d +EditParagraphUp = +EditParagraphDown = +EditSave = f2 +EditLoad = +EditSaveas = f12 +EditMark = f3 +EditCopy = f5 +EditMove = f6 +EditRemove = f8 +EditUnmark = +EditFind = f7 + +EditPageUpHighlight = shift-pgup +EditPageDownHighlight = shift-pgdn +EditLeftHighlight = shift-left +EditRightHighlight = shift-right +EditWordLeftHighlight = ctrl-shift-left +EditWordRightHighlight = ctrl-shift-right +EditUpHighlight = shift-up +EditDownHighlight = shift-down +EditHomeHighlight = shift-home +EditEndHighlight = shift-end +EditBeginningOfTextHighlight = ctrl-shift-home +EditEndOfTextHighlight = ctrl-shift-end +EditBeginPageHighlight = ctrl-shift-pgup +EditEndPageHighlight = ctrl-shift-pgdn +EditScrollUpHighlight = +EditScrollDownHighlight = +EditParagraphUpHighlight = +EditParagraphDownHighlight = + +EditPageUpAltHighlight = alt-pgup +EditPageDownAltHighlight = alt-pgdn +EditLeftAltHighlight = alt-left +EditRightAltHighlight = alt-right +EditWordLeftAltHighlight = ctrl-alt-left +EditWordRightAltHighlight = ctrl-alt-right +EditUpAltHighlight = alt-up +EditDownAltHighlight = alt-down +EditHomeAltHighlight = alt-home +EditEndAltHighlight = alt-end +EditBeginningOfTextAltHighlight = ctrl-alt-home +EditEndOfTextHighlight = ctrl-alt-end +EditBeginPageHighlight = ctrl-alt-pgup +EditEndPageAltHighlight = ctrl-alt-pgdn +EditScrollUpAltHighlight = +EditScrollDownAltHighlight = +EditParagraphUpAltHighlight = +EditParagraphDownAltHighlight = + +EditSaveBlock = +EditColumnMark = f13 +EditFindAgain = f17 +EditReplace = f4 +EditReplaceAgain = f14 +EditCompleteWord = alt-tab +EditDebugStart = +EditDebugStop = +EditDebugToggleBreak = +EditDebugClear = +EditDebugNext = +EditDebugStep = +EditDebugBackTrace = +EditDebugContinue = +EditDebugEnterCommand = +EditDebugUntilCurser = +EditInsertFile = f15 +EditQuit = f10 +EditToggleInsert = insert +EditHelp = f1 +EditDate = +EditRefresh = ctrl-l +EditGoto = alt-l +EditManPage = +EditSort = alt-t +EditMail = +EditCancel = +EditComplete = + +EditParagraphFormat = alt-p +EditUtil = +EditTypeLoadPython = +EditFindFile = +EditCtags = +EditMatchBracket = alt-b +EditTerminal = +EditTerminalApp = +EditExtCmd = alt-u +EditUserMenu = f11 +EditSaveDesktop = +EditNewWindow = +EditCycle = +EditMenu = f9 +EditSaveAndQuit = +EditRunAnother = +EditCheckSaveAndQuit = +EditMaximize = +EditToggleBookmark = +EditFlushBookmarks = +EditNextBookmark = +EditPrevBookmark = + +EditSelectionHistory = +EditShell = ctrl-o +EditInsertLiteral = ctrl-q + +EditBeginRecordMacro = ctrl-r +EditEndRecordMacro = ctrl-r +EditBeginOrEndMacro = ctrl-r +EditDeleteMacro = + +EditToggleLineState = alt-n +EditToggleTabTWS = alt-underline +EditToggleSyntax = ctrl-s + +EditFindDefinition = alt-enter +EditLoadPrevFile = alt-minus +EditLoadNextFile = alt-plus + +SelectCodepage = alt-e + +EditExtMode = ctrl-x + +[edit:xmap] +EditNew = k +EditExecuteMacro = e + +[viewer] +ViewSearch = question; slash; f7 +ViewContinueSearch = ctrl-r; ctrl-s; f17 +ViewMoveToBol = home +ViewMoveToEol = end +ViewMoveLeft = h; left +ViewMoveRight = l; right +ViewMoveUp = k; y; insert; up +ViewMoveDown = j; e; delete; down +ViewMovePgDn = f; space; pgdn +ViewMovePgUp = b; pgup +ViewMoveHalfPgDn = d +ViewMoveHalfPgUp = u +ViewGotoBookmark = m +ViewNewBookmark = r +ViewNextFile = ctrl-f +ViewPrevFile = ctrl-b +ViewQuit = q; esc +SelectCodepage = alt-e +ShowCommandLine = ctrl-o +ViewToggleRuler = alt-r + +[viewer:hex] +HexViewToggleNavigationMode = tab +ViewMoveToBol = ctrl-a; home +ViewMoveToEol = ctrl-e; end +ViewMoveLeft = b; left +ViewMoveRight = f; right +ViewMoveUp = k; y; up +ViewMoveDown = j; delete; down + +[main] +CmdUserMenu = f2 +CmdView = f3 +CmdViewFile = f13 +CmdEdit = f4 +CmdCopy = f5 +CmdRename = f6 +CmdMkdir = f7 +CmdDelete = f8 +CmdQuit = f10 +CmdMenuLastSelected = f19 +CmdQuietQuit = f20 +CmdFind = alt-question +CmdQuickCd = alt-c +CmdQuickChdir = ctrl-backslash +CmdReread = ctrl-r +CmdSingleDirsize = ctrl-space +CmdSuspend = ctrl-z +CmdSwapPanel = ctrl-u +CmdHistory = alt-h +CmdToggleListing = alt-t +CmdToggleShowHidden = alt-dot +ShowCommandLine = ctrl-o +CmdCopyCurrentPathname = alt-a +CmdCopyOtherPathname = alt-shift-a +CmdFilteredView = alt-exclamation +CmdSelect = kpplus +CmdUnselect = kpminus +CmdReverseSelection = alt-kpasterisk +ExtMap1 = ctrl-x + +[main:xmap] +CmdChmod = c +CmdChown = o +CmdCompareDirs = d +CmdEditSymlink = ctrl-s +CmdLink = l +CmdSymlink = s +CmdMenuInfo = i +CmdMenuQuickView = q +CmdExternalPanelize = exclamation +CmdReselectVfs = a +CmdJobs = j + +[panel] +PanelStartSearch = ctrl-s; alt-s +PanelMarkFile = insert; ctrl-t +PanelMoveDown = down; ctrl-n +PanelMoveUp = up; ctrl-p +PanelMoveLeft = left +PanelMoveRight = right +PanelPrevPage = pgup; alt-v +PanelNextPage = pgdn; ctrl-v +PanelDoEnter = enter +PanelChdirOtherPanel = alt-o +PanelChdirToReadlink = alt-l +PanelViewSimple = F13 +PanelEditNew = F14 +PanelCopyLocal = F15 +PanelRenameLocal = F16 +PanelDeleteLocal = F18 +PanelReverseSelection = alt-asterisk +PanelSelect = alt-plus +PanelUnselect = alt-minus +PanelCtrlNextPage = ctrl-pgdn +PanelCtrlPrevPage = ctrl-pgup +PanelDirectoryHistoryList = alt-shift-h +PanelDirectoryHistoryNext = alt-u +PanelDirectoryHistoryPrev = alt-y +PanelGotoBottomFile = alt-j +PanelGotoMiddleFile = alt-r +PanelSyncOtherPanel = alt-i +PanelGotoTopFile = alt-g +PanelSetPanelEncoding = alt-e +PanelMoveHome = alt-lt; home +PanelMoveEnd = alt-gt; end +PanelSelectSortOrder= +PanelToggleSortOrderPrev= +PanelToggleSortOrderNext= +PanelReverseSort= +PanelSortOrderByName= +PanelSortOrderByExt= +PanelSortOrderBySize= +PanelSortOrderByMTime= + + +[panel:xmap] + +[input] +InputBol = ctrl-a; alt-lt; home +InputEol = ctrl-e; alt-gt; end +InputMoveLeft = left; alt-left +InputWordLeft = ctrl-left +InputBackwardChar = ctrl-b +InputBackwardWord = alt-b +InputMoveRight = right; alt-right +InputWordRight = ctrl-right +InputForwardChar = ctrl-f +InputForwardWord = alt-f + +InputBackwardDelete = backspace +InputDeleteChar = delete +InputKillWord = alt-d +InputBackwardKillWord = alt-backspace +InputSetMark = +InputKillRegion = ctrl-w +InputKillSave = alt-w +InputYank = ctrl-y +InputKillLine = ctrl-k +InputHistoryPrev = alt-p; ctrl-down +InputHistoryNext = alt-n; ctrl-up +InputHistoryShow = alt-h +InputComplete = alt-tab diff --git a/src/keybind.c b/src/keybind.c index 09e129628..f82df730c 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -178,8 +178,8 @@ static const name_keymap_t command_names[] = { { "EditShell", CK_Shell }, { "EditInsertLiteral", CK_Insert_Literal }, { "EditExecuteMacro", CK_Execute_Macro }, - { "EditBeginorEndMacro", CK_Begin_End_Macro }, - { "EditExtmode", CK_Ext_Mode }, + { "EditBeginOrEndMacro", CK_Begin_End_Macro }, + { "EditExtMode", CK_Ext_Mode }, { "EditToggleLineState", CK_Toggle_Line_State }, { "EditToggleTabTWS", CK_Toggle_Tab_TWS }, { "EditToggleSyntax", CK_Toggle_Syntax }, @@ -427,10 +427,10 @@ const global_keymap_t default_viewer_keymap[] = { { ' ', CK_ViewMovePgDn, "Space" }, { 'f', CK_ViewMovePgDn, "f" }, - { KEY_NPAGE, CK_ViewMovePgDn, "PageDown" }, + { KEY_NPAGE, CK_ViewMovePgDn, "PgDn" }, { 'b', CK_ViewMovePgUp, "b" }, - { KEY_PPAGE, CK_ViewMovePgUp, "PageUp" }, + { KEY_PPAGE, CK_ViewMovePgUp, "PgUp" }, { 'd', CK_ViewMoveHalfPgDn, "d" }, { 'u', CK_ViewMoveHalfPgUp, "u" }, @@ -487,8 +487,8 @@ const global_keymap_t default_editor_keymap[] = { { KEY_HOME, CK_Home, "Home" }, { KEY_IC, CK_Toggle_Insert, "Insert" }, { KEY_LEFT, CK_Left, "Left" }, - { KEY_NPAGE, CK_Page_Down, "PageDown" }, - { KEY_PPAGE, CK_Page_Up, "PageUp" }, + { KEY_NPAGE, CK_Page_Down, "PgDn" }, + { KEY_PPAGE, CK_Page_Up, "PgUp" }, { KEY_RIGHT, CK_Right, "Right" }, { KEY_UP, CK_Up, "Up" }, @@ -502,7 +502,7 @@ const global_keymap_t default_editor_keymap[] = { { ALT ('<'), CK_Beginning_Of_Text, "M-<" }, { ALT ('>'), CK_End_Of_Text, "M->" }, { ALT ('-'), CK_Load_Prev_File, "M--" }, - { ALT ('='), CK_Load_Next_File, "M-=" }, + { ALT ('+'), CK_Load_Next_File, "M-+" }, { ALT ('d'), CK_Delete_Word_Right, "M-d" }, { ALT (KEY_BACKSPACE), CK_Delete_Word_Left, "M-BackSpace" }, { ALT ('n'), CK_Toggle_Line_State, "M-n" }, @@ -512,6 +512,7 @@ const global_keymap_t default_editor_keymap[] = { { ALT ('j'), CK_Next_Bookmark, "M-j" }, { ALT ('o'), CK_Flush_Bookmarks, "M-o" }, + { XCTRL ('n'), CK_New, "C-n" }, { XCTRL ('k'), CK_Delete_To_Line_End, "C-k" }, { XCTRL ('l'), CK_Refresh, "C-l" }, { XCTRL ('o'), CK_Shell, "C-o" }, @@ -519,8 +520,10 @@ const global_keymap_t default_editor_keymap[] = { { XCTRL ('u'), CK_Undo, "C-u" }, { ALT ('e'), CK_SelectCodepage, "M-e" }, { XCTRL ('q'), CK_Insert_Literal, "C-q" }, - { XCTRL ('a'), CK_Execute_Macro, "C-a" }, { XCTRL ('r'), CK_Begin_End_Macro, "C-r" }, + { XCTRL ('r'), CK_Begin_Record_Macro, "C-r" }, + { XCTRL ('r'), CK_End_Record_Macro, "C-r" }, + { XCTRL ('a'), CK_Execute_Macro, "C-a" }, { KEY_F (1), CK_Help, "F1" }, { KEY_F (2), CK_Save, "F2" }, @@ -542,8 +545,8 @@ const global_keymap_t default_editor_keymap[] = { { KEY_F (19), CK_Pipe_Block (0), "S-F9" }, /* Shift */ - { KEY_M_SHIFT | KEY_PPAGE, CK_Page_Up_Highlight, "S-PageUp" }, - { KEY_M_SHIFT | KEY_NPAGE, CK_Page_Down_Highlight, "S-PageDown" }, + { KEY_M_SHIFT | KEY_NPAGE, CK_Page_Down_Highlight, "S-PgDn" }, + { KEY_M_SHIFT | KEY_PPAGE, CK_Page_Up_Highlight, "S-PgUp" }, { KEY_M_SHIFT | KEY_LEFT, CK_Left_Highlight, "S-Left" }, { KEY_M_SHIFT | KEY_RIGHT, CK_Right_Highlight, "S-Right" }, { KEY_M_SHIFT | KEY_UP, CK_Up_Highlight, "S-Up" }, @@ -556,8 +559,8 @@ const global_keymap_t default_editor_keymap[] = { { KEY_M_SHIFT | '\n', CK_Return, "S-Enter" }, /* Alt */ - { KEY_M_ALT | KEY_PPAGE, CK_Page_Up_Alt_Highlight, "M-PageUp" }, - { KEY_M_ALT | KEY_NPAGE, CK_Page_Down_Alt_Highlight, "M-PageDown" }, + { KEY_M_ALT | KEY_NPAGE, CK_Page_Down_Alt_Highlight, "M-PgDn" }, + { KEY_M_ALT | KEY_PPAGE, CK_Page_Up_Alt_Highlight, "M-PgUp" }, { KEY_M_ALT | KEY_LEFT, CK_Left_Alt_Highlight, "M-Left" }, { KEY_M_ALT | KEY_RIGHT, CK_Right_Alt_Highlight, "M-Right" }, { KEY_M_ALT | KEY_UP, CK_Up_Alt_Highlight, "M-Up" }, @@ -570,8 +573,8 @@ const global_keymap_t default_editor_keymap[] = { { KEY_M_CTRL | (KEY_F (4)), CK_Replace_Again, "C-F4" }, { KEY_M_CTRL | (KEY_F (7)), CK_Find_Again, "C-F7" }, { KEY_M_CTRL | KEY_BACKSPACE, CK_Undo, "C-BackSpase" }, - { KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text, "C-PageUp" }, - { KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text, "C-PageDown" }, + { KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text, "C-PgDn" }, + { KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text, "C-PgUp" }, { KEY_M_CTRL | KEY_HOME, CK_Beginning_Of_Text, "C-Home" }, { KEY_M_CTRL | KEY_END, CK_End_Of_Text, "C-End" }, { KEY_M_CTRL | KEY_UP, CK_Scroll_Up, "C-Up" }, @@ -582,19 +585,22 @@ const global_keymap_t default_editor_keymap[] = { { KEY_M_CTRL | KEY_DC, CK_Remove, "C-Delete" }, /* Ctrl + Shift */ - { KEY_M_SHIFT | KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text_Highlight, "C-S-PageUp" }, - { KEY_M_SHIFT | KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text_Highlight, "C-S-PageDown" }, + { KEY_M_SHIFT | KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text_Highlight, "C-S-PgDn" }, + { KEY_M_SHIFT | KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text_Highlight, "C-S-PgUp" }, { KEY_M_SHIFT | KEY_M_CTRL | KEY_LEFT, CK_Word_Left_Highlight, "C-S-Left" }, { KEY_M_SHIFT | KEY_M_CTRL | KEY_RIGHT, CK_Word_Right_Highlight, "C-S-Right" }, { KEY_M_SHIFT | KEY_M_CTRL | KEY_UP, CK_Scroll_Up_Highlight, "C-S-Up" }, { KEY_M_SHIFT | KEY_M_CTRL | KEY_DOWN, CK_Scroll_Down_Highlight, "C-S-Down" }, - { XCTRL ('x'), CK_StartExtMap1, "C-x" }, + { XCTRL ('x'), CK_Ext_Mode, "C-x" }, { 0, 0, "" } }; +/* emacs keyboard layout emulation */ const global_keymap_t default_editor_x_keymap[] = { + { 'k', CK_New, "k"}, + { 'e', CK_Execute_Macro, "e"}, { 0, 0, "" } }; #endif @@ -613,8 +619,8 @@ const global_keymap_t default_panel_keymap[] = { { KEY_KP_ADD, CK_PanelCmdSelect, "Gray+" }, { KEY_KP_SUBTRACT, CK_PanelCmdUnselect, "Gray-" }, { KEY_F (13), CK_PanelCmdViewSimple, "S-F3" }, - { KEY_M_CTRL | KEY_NPAGE, CK_PanelCtrlNextPage, "C-PageDown" }, - { KEY_M_CTRL | KEY_PPAGE, CK_PanelCtrlPrevPage, "C-PageUp" }, + { KEY_M_CTRL | KEY_NPAGE, CK_PanelCtrlNextPage, "C-PgDn" }, + { KEY_M_CTRL | KEY_PPAGE, CK_PanelCtrlPrevPage, "C-PgUp" }, { ALT ('H'), CK_PanelDirectoryHistoryList, "M-H" }, { ALT ('u'), CK_PanelDirectoryHistoryNext, "M-u" }, { ALT ('y'), CK_PanelDirectoryHistoryPrev, "M-y" }, @@ -629,8 +635,8 @@ const global_keymap_t default_panel_keymap[] = { { KEY_END, CK_PanelMoveEnd, "End" }, { KEY_HOME, CK_PanelMoveHome, "Home" }, { KEY_A1, CK_PanelMoveHome, "Home" }, - { KEY_NPAGE, CK_PanelNextPage, "PageDown" }, - { KEY_PPAGE, CK_PanelPrevPage, "PageUp" }, + { KEY_NPAGE, CK_PanelNextPage, "PgDn" }, + { KEY_PPAGE, CK_PanelPrevPage, "PgUp" }, { ALT ('e'), CK_PanelSetPanelEncoding, "M-e" }, { XCTRL ('s'), CK_PanelStartSearch, "C-s" }, { ALT ('s'), CK_PanelStartSearch, "M-s" }, @@ -800,7 +806,7 @@ lookup_keymap_shortcut (const global_keymap_t *keymap, int action) for (i = 0; keymap[i].key != 0; i++) if (keymap[i].command == action) - return (keymap[i].caption[0] != '\0') ? keymap[i]. caption : NULL; + return (keymap[i].caption[0] != '\0') ? keymap[i].caption : NULL; return NULL; } diff --git a/src/screen.c b/src/screen.c index 3de3cbe34..020e652b8 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2856,7 +2856,7 @@ panel_callback (Widget *w, widget_msg_t msg, int parm) buttonbar_set_label (h, 3, Q_("ButtonBar|View"), view_cmd); buttonbar_set_label (h, 4, Q_("ButtonBar|Edit"), edit_cmd); buttonbar_set_label (h, 5, Q_("ButtonBar|Copy"), copy_cmd); - buttonbar_set_label (h, 6, Q_("ButtonBar|RenMov"), ren_cmd); + buttonbar_set_label (h, 6, Q_("ButtonBar|RenMov"), rename_cmd); buttonbar_set_label (h, 7, Q_("ButtonBar|Mkdir"), mkdir_cmd); buttonbar_set_label (h, 8, Q_("ButtonBar|Delete"), delete_cmd); buttonbar_redraw (h); diff --git a/src/setup.c b/src/setup.c index 1b993909d..cf48c20f9 100644 --- a/src/setup.c +++ b/src/setup.c @@ -200,7 +200,6 @@ static const struct { #endif /* USE_VFS */ #ifdef USE_INTERNAL_EDIT { "editor_word_wrap_line_length", &option_word_wrap_line_length }, - { "editor_key_emulation", &edit_key_emulation }, { "editor_tab_spacing", &option_tab_spacing }, { "editor_fill_tabs_with_spaces", &option_fill_tabs_with_spaces }, { "editor_return_does_auto_indent", &option_return_does_auto_indent }, diff --git a/src/tty/key.c b/src/tty/key.c index 9e911caee..2d4bb0be5 100644 --- a/src/tty/key.c +++ b/src/tty/key.c @@ -116,7 +116,7 @@ key_code_name_t key_name_conv_tab[] = { { KEY_F (18), "f18", N_("Function key 18"), "F18" }, { KEY_F (19), "f19", N_("Function key 19"), "F19" }, { KEY_F (20), "f20", N_("Function key 20"), "F20" }, - { KEY_BACKSPACE, "bs", N_("Backspace key"), "Backspace" }, + { KEY_BACKSPACE, "backspace", N_("Backspace key"), "Backspace" }, { KEY_END, "end", N_("End key"), "End" }, { KEY_UP, "up", N_("Up arrow key"), "Up" }, { KEY_DOWN, "down", N_("Down arrow key"), "Down" }, @@ -125,7 +125,7 @@ key_code_name_t key_name_conv_tab[] = { { KEY_HOME, "home", N_("Home key"), "Home" }, { KEY_NPAGE, "pgdn", N_("Page Down key"), "PgDn" }, { KEY_PPAGE, "pgup", N_("Page Up key"), "PgUp" }, - { KEY_IC, "ins", N_("Insert key"), "Ins" }, + { KEY_IC, "insert", N_("Insert key"), "Ins" }, { KEY_DC, "delete", N_("Delete key"), "Del" }, { ALT ('\t'), "complete", N_("Completion/M-tab"), "Meta-Tab" }, { KEY_KP_ADD, "kpplus", N_("+ on keypad"), "Gray+" }, @@ -152,36 +152,37 @@ key_code_name_t key_name_conv_tab[] = { /* Alternative label */ - { KEY_BACKSPACE, "backspace", N_("Backspace key"), "Bakspace" }, - { KEY_IC, "insert", N_("Insert key"), "Ins" }, - { (int) '+', "plus", N_("Plus"), "+" }, - { (int) '-', "minus", N_("Minus"), "-" }, - { (int) '*', "asterisk", N_("Asterisk"), "*" }, - { (int) '.', "dot", N_("Dot"), "." }, - { (int) '<', "lt", N_("Less than"), "<" }, - { (int) '>', "gt", N_("Great than"), ">" }, - { (int) '=', "equal", N_("Equal"), "=" }, - { (int) ',', "comma", N_("Comma"), "," }, - { (int) '\'', "apostrophe", N_("Apostrophe"), "\'" }, - { (int) ':', "colon", N_("Colon"), ":" }, - { (int) '!', "exclamation", N_("Exclamation mark"), "!" }, - { (int) '?', "question", N_("Question mark"), "?" }, - { (int) '&', "ampersand", N_("Ampersand"), "&" }, - { (int) '$', "dollar", N_("Dollar sign"), "$" }, - { (int) '"', "quota", N_("Quotation mark"), "\"" }, - { (int) '^', "caret", N_("Caret"), "^" }, - { (int) '~', "tilda", N_("Tilda"), "~" }, - { (int) '`', "prime", N_("Prime"), "`" }, - { (int) '_', "underline", N_("Underline"), "_" }, - { (int) '_', "understrike", N_("Understrike"), "_" }, - { (int) '|', "pipe", N_("Pipe"), "|" }, - { (int) '\n', "enter", N_("Enter"), "Enter" }, - { (int) '\t', "tab", N_("Tab key"), "Tab" }, - { (int) ' ', "space", N_("Space key"), "Space" }, - { (int) '/', "slash", N_("Slash key"), "/" }, - { (int) '\\', "backslash", N_("Backslash key"), "\\" }, - { (int) '#', "number", N_("Number sign #"), "#" }, - { (int) '#', "hash", N_("Number sign #"), "#" }, + { KEY_BACKSPACE, "bs", N_("Backspace key"), "Bakspace" }, + { KEY_IC, "ins", N_("Insert key"), "Ins" }, + { KEY_DC, "del", N_("Delete key"), "Del" }, + { (int) '+', "plus", N_("Plus"), "+" }, + { (int) '-', "minus", N_("Minus"), "-" }, + { (int) '*', "asterisk", N_("Asterisk"), "*" }, + { (int) '.', "dot", N_("Dot"), "." }, + { (int) '<', "lt", N_("Less than"), "<" }, + { (int) '>', "gt", N_("Great than"), ">" }, + { (int) '=', "equal", N_("Equal"), "=" }, + { (int) ',', "comma", N_("Comma"), "," }, + { (int) '\'', "apostrophe", N_("Apostrophe"), "\'" }, + { (int) ':', "colon", N_("Colon"), ":" }, + { (int) '!', "exclamation", N_("Exclamation mark"), "!" }, + { (int) '?', "question", N_("Question mark"), "?" }, + { (int) '&', "ampersand", N_("Ampersand"), "&" }, + { (int) '$', "dollar", N_("Dollar sign"), "$" }, + { (int) '"', "quota", N_("Quotation mark"), "\"" }, + { (int) '^', "caret", N_("Caret"), "^" }, + { (int) '~', "tilda", N_("Tilda"), "~" }, + { (int) '`', "prime", N_("Prime"), "`" }, + { (int) '_', "underline", N_("Underline"), "_" }, + { (int) '_', "understrike", N_("Understrike"), "_" }, + { (int) '|', "pipe", N_("Pipe"), "|" }, + { (int) '\n', "enter", N_("Enter"), "Enter" }, + { (int) '\t', "tab", N_("Tab key"), "Tab" }, + { (int) ' ', "space", N_("Space key"), "Space" }, + { (int) '/', "slash", N_("Slash key"), "/" }, + { (int) '\\', "backslash", N_("Backslash key"), "\\" }, + { (int) '#', "number", N_("Number sign #"), "#" }, + { (int) '#', "hash", N_("Number sign #"), "#" }, /* meta keys */ { KEY_M_CTRL, "control", N_("Ctrl"), "C" }, @@ -1312,9 +1313,15 @@ lookup_key (const char *keyname, char **label) g_string_append (s, key_name_conv_tab[use_ctrl].shortcut); g_string_append_c (s, '-'); } - if (use_shift != -1) - g_string_append_c (s, (gchar) g_ascii_toupper ((gchar) k)); - else if (k < 128) { + if (use_shift != -1) { + if (k < 127) + g_string_append_c (s, (gchar) g_ascii_toupper ((gchar) k)); + else { + g_string_append (s, key_name_conv_tab[use_shift].shortcut); + g_string_append_c (s, '-'); + g_string_append (s, key_name_conv_tab[index].shortcut); + } + } else if (k < 128) { if ((k >= 'A') || (index < 0) || (key_name_conv_tab[index].shortcut == NULL)) g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) k));