Ticket #2585 (Ask filename before create new file)

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
Ilia Maslakov 2013-01-24 18:07:35 +04:00
parent c87e38c3c7
commit 6e5b50cb6f
3 changed files with 26 additions and 2 deletions

View File

@ -3,7 +3,7 @@
They normally operate on the current panel.
Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2009, 2011
2005, 2006, 2007, 2009, 2011, 2013
The Free Software Foundation, Inc.
This file is part of the Midnight Commander.
@ -818,10 +818,29 @@ edit_cmd_force_internal (void)
void
edit_cmd_new (void)
{
vfs_path_t *fname_vpath = NULL;
if (editor_ask_filename_before_edit)
{
char *fname;
fname = input_expand_dialog (_("Edit file"), _("Enter file name:"),
MC_HISTORY_EDIT_LOAD, "");
if (fname == NULL)
return;
if (*fname != '\0')
fname_vpath = vfs_path_from_str (fname);
g_free (fname);
}
#ifdef HAVE_CHARSET
mc_global.source_codepage = default_source_codepage;
#endif
do_edit (NULL);
do_edit (fname_vpath);
vfs_path_free (fname_vpath);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -115,6 +115,9 @@ int drop_menus = 0;
are tagged files */
int confirm_view_dir = 0;
/* Ask file name before start the editor */
int editor_ask_filename_before_edit = 0;
panel_view_mode_t startup_left_mode;
panel_view_mode_t startup_right_mode;
@ -353,6 +356,7 @@ static const struct
{ "editor_show_right_margin", &show_right_margin },
{ "editor_group_undo", &option_group_undo },
#endif /* USE_INTERNAL_EDIT */
{ "editor_ask_filename_before_edit", &editor_ask_filename_before_edit },
{ "nice_rotating_dash", &nice_rotating_dash },
{ "mcview_remember_file_position", &mcview_remember_file_position },
{ "auto_fill_mkdir_name", &auto_fill_mkdir_name },

View File

@ -98,6 +98,7 @@ extern int auto_fill_mkdir_name;
extern int output_starts_shell;
extern int use_file_to_check_type;
extern int file_op_compute_totals;
extern int editor_ask_filename_before_edit;
extern panels_options_t panels_options;