From 0ac261de1b67e1b4fe9048d47607ecfecfa02b8f Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 29 Oct 2012 17:20:54 +0400 Subject: [PATCH] Init file highlighting only in full mode. Signed-off-by: Andrew Borodin --- src/filemanager/midnight.c | 12 +++++++----- src/filemanager/panel.c | 3 ++- src/filemanager/panel.h | 3 +++ src/main.c | 2 -- src/setup.c | 3 --- src/setup.h | 2 -- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index 9c0184a52..6049ca8c6 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -1759,17 +1759,19 @@ do_nc (void) midnight_dlg = create_dlg (FALSE, 0, 0, LINES, COLS, midnight_colors, midnight_callback, midnight_event, "[main]", NULL, DLG_WANT_IDLE); - if (mc_global.mc_run_mode == MC_RUN_FULL) - setup_mc (); - else - setup_dummy_mc (); - /* Check if we were invoked as an editor or file viewer */ if (mc_global.mc_run_mode != MC_RUN_FULL) + { + setup_dummy_mc (); ret = mc_maybe_editor_or_viewer (); + } else { + setup_mc (); + mc_filehighlight = mc_fhl_new (TRUE); create_panels_and_run_mc (); + mc_fhl_free (&mc_filehighlight); + ret = TRUE; /* destroy_dlg destroys even current_panel->cwd_vpath, so we have to save a copy :) */ diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c index 39b9bb911..ac52a8005 100644 --- a/src/filemanager/panel.c +++ b/src/filemanager/panel.c @@ -44,7 +44,6 @@ #include "lib/tty/key.h" /* XCTRL and ALT macros */ #include "lib/skin.h" #include "lib/strescape.h" -#include "lib/filehighlight.h" #include "lib/mcconfig.h" #include "lib/vfs/vfs.h" #include "lib/unixcompat.h" @@ -308,6 +307,8 @@ panel_field_t panel_fields[] = { }; /* *INDENT-ON* */ +mc_fhl_t *mc_filehighlight = NULL; + extern int saving_setup; /*** file scope macro definitions ****************************************************************/ diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h index 62b929824..00ca21071 100644 --- a/src/filemanager/panel.h +++ b/src/filemanager/panel.h @@ -11,6 +11,7 @@ #include "lib/fs.h" /* MC_MAXPATHLEN */ #include "lib/strutil.h" #include "lib/widget.h" /* Widget */ +#include "lib/filehighlight.h" #include "dir.h" /* dir_list */ @@ -146,6 +147,8 @@ extern panel_field_t panel_fields[]; extern hook_t *select_file_hook; +extern mc_fhl_t *mc_filehighlight; + /*** declarations of public functions ************************************************************/ WPanel *panel_new (const char *panel_name); diff --git a/src/main.c b/src/main.c index 8e68166d3..c25d72e1a 100644 --- a/src/main.c +++ b/src/main.c @@ -357,7 +357,6 @@ main (int argc, char *argv[]) error = NULL; } - mc_filehighlight = mc_fhl_new (TRUE); dlg_set_default_colors (); #ifdef ENABLE_SUBSHELL @@ -402,7 +401,6 @@ main (int argc, char *argv[]) flush_extension_file (); /* does only free memory */ - mc_fhl_free (&mc_filehighlight); mc_skin_deinit (); tty_colors_done (); diff --git a/src/setup.c b/src/setup.c index ecaa66dec..c39957fef 100644 --- a/src/setup.c +++ b/src/setup.c @@ -35,7 +35,6 @@ #include "lib/global.h" -#include "lib/filehighlight.h" #include "lib/tty/tty.h" #include "lib/tty/key.h" #include "lib/mcconfig.h" @@ -191,8 +190,6 @@ gboolean is_autodetect_codeset_enabled = FALSE; /* If set, then print to the given file the last directory we were at */ char *last_wd_string = NULL; -mc_fhl_t *mc_filehighlight; - /* Set when main loop should be terminated */ int quit = 0; diff --git a/src/setup.h b/src/setup.h index f40be383f..4ec473ddd 100644 --- a/src/setup.h +++ b/src/setup.h @@ -120,8 +120,6 @@ extern int quit; /* Set to TRUE to suppress printing the last directory */ extern gboolean print_last_revert; -extern struct mc_fhl_struct *mc_filehighlight; - extern char *shell; extern const char *mc_prompt; -- 2.11.4.GIT