1
1

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
Этот коммит содержится в:
Ilia Maslakov 2009-06-28 17:28:47 +00:00
родитель 9e92f803cc
Коммит d205e724f0
2 изменённых файлов: 17 добавлений и 18 удалений

Просмотреть файл

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

Просмотреть файл

@ -245,7 +245,7 @@ int drop_menus = 0;
int skip_check_codeset = 0; int skip_check_codeset = 0;
/* The dialog handle for the main program */ /* 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 */ /* Subshell: if set, then the prompt was not saved on CONSOLE_SAVE */
/* We need to paint it after CONSOLE_RESTORE, see: load_prompt */ /* We need to paint it after CONSOLE_RESTORE, see: load_prompt */
@ -1852,29 +1852,27 @@ do_nc (void)
midnight_colors[2] = INPUT_COLOR; /* HOT_NORMALC */ midnight_colors[2] = INPUT_COLOR; /* HOT_NORMALC */
midnight_colors[3] = NORMAL_COLOR; /* HOT_FOCUSC */ midnight_colors[3] = NORMAL_COLOR; /* HOT_FOCUSC */
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 */ midnight_dlg = create_dlg (0, 0, LINES, COLS, midnight_colors, midnight_callback,
if (mc_maybe_editor_or_viewer ()) "[main]", NULL, DLG_WANT_IDLE);
return;
setup_mc ();
/* start check display_codepage and source_codepage */
check_codeset(); check_codeset();
setup_panels_and_run_mc (); /* 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 */ /* Program end */
midnight_shutdown = 1; midnight_shutdown = 1;
/* destroy_dlg destroys even current_panel->cwd, so we have to save a copy :) */ /* destroy_dlg destroys even current_panel->cwd, so we have to save a copy :) */
if (last_wd_file && vfs_current_is_local ()) { if (last_wd_file && vfs_current_is_local ()) {
last_wd_string = g_strdup (current_panel->cwd); last_wd_string = g_strdup (current_panel->cwd);
}
done_mc ();
} }
done_mc ();
destroy_dlg (midnight_dlg); destroy_dlg (midnight_dlg);
current_panel = 0; current_panel = 0;
done_mc_profile (); done_mc_profile ();