Ticket #343 (automatically detect user's charset) reopened

fix: check if mc is run as viewer or editor mode.
fix: little memory leak
fix: dlg_erase now check input parameters
This commit is contained in:
Ilia Maslakov 2009-06-28 17:28:47 +00:00
parent 9e92f803cc
commit d205e724f0
2 changed files with 17 additions and 18 deletions

View File

@ -117,7 +117,8 @@ void widget_erase (Widget *w)
void dlg_erase (Dlg_head *h)
{
int x, y;
if (h == NULL)
return;
for (y = 0; y < h->lines; y++){
move (y+h->y, h->x); /* FIXME: should test if ERR */
for (x = 0; x < h->cols; x++){

View File

@ -245,7 +245,7 @@ int drop_menus = 0;
int skip_check_codeset = 0;
/* The dialog handle for the main program */
Dlg_head *midnight_dlg;
Dlg_head *midnight_dlg = NULL;
/* Subshell: if set, then the prompt was not saved on CONSOLE_SAVE */
/* We need to paint it after CONSOLE_RESTORE, see: load_prompt */
@ -1852,18 +1852,16 @@ do_nc (void)
midnight_colors[2] = INPUT_COLOR; /* HOT_NORMALC */
midnight_colors[3] = NORMAL_COLOR; /* HOT_FOCUSC */
midnight_dlg =
create_dlg (0, 0, LINES, COLS, midnight_colors, midnight_callback,
midnight_dlg = create_dlg (0, 0, LINES, COLS, midnight_colors, midnight_callback,
"[main]", NULL, DLG_WANT_IDLE);
/* Check if we were invoked as an editor or file viewer */
if (mc_maybe_editor_or_viewer ())
return;
setup_mc ();
/* start check display_codepage and source_codepage */
check_codeset();
/* Check if we were invoked as an editor or file viewer */
if (!mc_maybe_editor_or_viewer ()) {
setup_mc ();
setup_panels_and_run_mc ();
/* Program end */
@ -1874,7 +1872,7 @@ do_nc (void)
last_wd_string = g_strdup (current_panel->cwd);
}
done_mc ();
}
destroy_dlg (midnight_dlg);
current_panel = 0;
done_mc_profile ();