diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index 35de76bbd..ff24c9442 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -1874,6 +1874,9 @@ command is used. See the section on the internal file viewer\&. .\"Internal File Viewer" .PP +.I Ask new file name +If this option is enabled, file name is asked before open new file in editor. +.PP .I Auto menus. If this option is enabled, the user menu will be invoked at startup. Useful for building menus for non\-unixers. diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index 77dda99e9..f7e51dbe9 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -2002,6 +2002,10 @@ FreeBSD или при использовании xterm вы можете про компьютере работают неопытные пользователи (операторы), которые должны выполнять только стандартные операции. .PP +.I Спрашивать имя нового файла. +Если эта опция включена, то перед открытием нового файла в редакторе +будет запрошено его имя. +.PP .I Выпадение меню при вызове. Если эта опция включена, то при вызове главного меню нажатием клавиши F9 будет сразу отображаться перечень пунктов меню (выпадающее меню). diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c index db01587f6..c11dfb788 100644 --- a/src/filemanager/boxes.c +++ b/src/filemanager/boxes.c @@ -458,7 +458,7 @@ configure_box (void) QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL), QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL), QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL), - QUICK_CHECKBOX (N_("Preallocate &space"), &mc_global.vfs.preallocate_space, + QUICK_CHECKBOX (N_("&Preallocate space"), &mc_global.vfs.preallocate_space, NULL), QUICK_STOP_GROUPBOX, QUICK_START_GROUPBOX (N_("Esc key mode")), @@ -474,9 +474,11 @@ configure_box (void) QUICK_START_GROUPBOX (N_("Other options")), QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL), QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL), + QUICK_CHECKBOX (N_("A&sk new file name"), + &editor_ask_filename_before_edit, NULL), QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL), QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL), - QUICK_CHECKBOX (N_("Shell &patterns"), &easy_patterns, NULL), + QUICK_CHECKBOX (N_("S&hell patterns"), &easy_patterns, NULL), QUICK_CHECKBOX (N_("Co&mplete: show all"), &mc_global.widget.show_all_if_ambiguous, NULL), QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL), @@ -486,7 +488,6 @@ configure_box (void) QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE), - QUICK_SEPARATOR (FALSE), QUICK_STOP_GROUPBOX, QUICK_STOP_COLUMNS, QUICK_BUTTONS_OK_CANCEL, diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c index af1b0c3bf..39cb9a22f 100644 --- a/src/filemanager/cmd.c +++ b/src/filemanager/cmd.c @@ -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); } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/setup.c b/src/setup.c index bbe1f36dd..1e5e8c648 100644 --- a/src/setup.c +++ b/src/setup.c @@ -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 }, diff --git a/src/setup.h b/src/setup.h index 234821b51..c5728ae68 100644 --- a/src/setup.h +++ b/src/setup.h @@ -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;