Added --nokeymap command line option to disable load keybindings from file.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Andrew Borodin 2011-02-21 13:49:45 +03:00
parent 722121a575
commit 4fbdbd4456
7 changed files with 27 additions and 9 deletions

View File

@ -62,6 +62,9 @@ database. Only useful on HP terminals when the function keys don't work.
.I \-K file
Specify a name of keymap file in the command line.
.TP
.I \-\-nokeymap
Don't load key bindings from any file, use default hardcoded keys.
.TP
.I \-l file, \-\-ftplog=file
Save the ftpfs dialog with the server in file.
.TP

View File

@ -73,8 +73,12 @@ termcap/terminfo. Этот ключ используется только на
функциональные клавиши не работают.
.TP
.I \-K файл
Задаёт файл клавиатурных команд для переопределения привязки хоткеев
к действиям.
Задаёт файл клавиатурных команд для переопределения привязки клавиатурных
комбинаций к действиям.
.TP
.I \-\-nokeymap
Не загружать клавиатурные комбинации из файла, использовать определённые
в исходном коде.
.TP
.I \-l файл
Сохранить диалог с ftp\-сервером, а также отладочную информацию smbfs в

View File

@ -69,10 +69,13 @@ gboolean mc_args__disable_colors = FALSE;
/* Force colors, only used by Slang */
gboolean mc_args__force_colors = FALSE;
/* Don't load keymap form file and use default one */
gboolean mc_args__nokeymap = FALSE;
/* Line to start the editor on */
int mc_args__edit_start_line = 0;
/* Show in specified skin */
/* Use the specified skin */
char *mc_args__skin = NULL;
char *mc_args__last_wd_file = NULL;
@ -240,6 +243,13 @@ static const GOptionEntry argument_terminal_table[] = {
"<file>"
},
{
"nokeymap", '\0', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
&mc_args__nokeymap,
N_("Don't load definitions of key bindings from file, use defaults"),
NULL
},
{
NULL, '\0', 0, 0, NULL, NULL, NULL /* Complete struct initialization */
}

View File

@ -17,6 +17,7 @@ extern gboolean mc_args__slow_terminal;
extern gboolean mc_args__ugly_line_drawing;
extern gboolean mc_args__disable_colors;
extern gboolean mc_args__force_colors;
extern gboolean mc_args__nokeymap;
extern char *mc_args__skin;
extern gboolean mc_args__version;
extern int mc_args__edit_start_line;

View File

@ -485,7 +485,7 @@ main (int argc, char *argv[])
/* Removing this from the X code let's us type C-c */
load_key_defs ();
load_keymap_defs ();
load_keymap_defs (!mc_args__nokeymap);
macros_list = g_array_new (TRUE, FALSE, sizeof (macros_t));

View File

@ -689,7 +689,6 @@ load_setup_get_keymap_profile_config (void)
g_free (fname);
/* 4) main config; [Midnight Commander] -> keymap */
fname2 =
mc_config_get_string (mc_main_config, CONFIG_APP_SECTION, "keymap", GLOBAL_KEYMAP_FILE);
fname = load_setup_get_full_config_name (NULL, fname2);
@ -1155,15 +1154,16 @@ load_anon_passwd (void)
/* --------------------------------------------------------------------------------------------- */
void
load_keymap_defs (void)
load_keymap_defs (gboolean load_from_file)
{
/*
* Load keymap from GLOBAL_KEYMAP_FILE before ${XDG_DATA_HOME}/mc/keymap, so that the user
* definitions override global settings.
*/
mc_config_t *mc_global_keymap;
mc_config_t *mc_global_keymap = NULL;
mc_global_keymap = load_setup_get_keymap_profile_config ();
if (load_from_file)
mc_global_keymap = load_setup_get_keymap_profile_config ();
if (mc_global_keymap != NULL)
{

View File

@ -109,7 +109,7 @@ void load_key_defs (void);
char *load_anon_passwd (void);
#endif /* ENABLE_VFS_FTP */
void load_keymap_defs (void);
void load_keymap_defs (gboolean load_from_file);
void free_keymap_defs (void);
void panel_load_setup (WPanel * panel, const char *section);