updated: [e3a82ba] Signed-off-by: Mikhail S. Pobolovets <styx.mp at gmail.com>

Sergei Trofimovich st at anti-virus.by
Mon Jan 26 11:34:16 UTC 2009


The following commit has been merged in the master branch:
commit e3a82ba1d8585c458f030688c6364e4102c2cc13
Author: Mikhail S. Pobolovets <styx.mp at gmail.com>
Date:   Thu Jan 22 23:29:10 2009 +0200

    Signed-off-by: Mikhail S. Pobolovets <styx.mp at gmail.com>
    
    Automatic new directory(Mkdir, F7) name filling.
    Can be configured (on|off) in 'Configure options'.

diff --git a/src/cmd.c b/src/cmd.c
index a3ea05c..84f6e07 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -77,6 +77,8 @@ int output_starts_shell = 0;
 /* If set, use the builtin editor */
 int use_internal_edit = 1;
 
+/* Automatically fills name with current selected item name on mkdir */
+int auto_fill_mkdir_name = 1;
 
 int
 view_file_at_line (const char *filename, int plain_view, int internal,
@@ -351,11 +353,18 @@ void
 mkdir_cmd (void)
 {
     char *dir, *absdir;
+    char *name = "";
+
+    /* If 'on' then automatically fills name with current selected item name */
+    if (auto_fill_mkdir_name)
+        name = selection (current_panel)->fname;
 
     dir =
 	input_expand_dialog (_("Create a new Directory"),
-			     _(" Enter directory name:"), 
-			     MC_HISTORY_FM_MKDIR, "");
+			     _(" Enter directory name:"),
+			     MC_HISTORY_FM_MKDIR,
+			     name);
+
     if (!dir)
 	return;
 
diff --git a/src/main.h b/src/main.h
index fb38e7a..1500548 100644
--- a/src/main.h
+++ b/src/main.h
@@ -71,6 +71,7 @@ extern int output_starts_shell;
 extern int midnight_shutdown;
 extern char cmd_buf [512];
 extern const char *shell;
+extern int auto_fill_mkdir_name;
 
 /* Ugly hack in order to distinguish between left and right panel in menubar */
 extern int is_right;		/* If the selected menu was the right */
diff --git a/src/option.c b/src/option.c
index 2898266..1649b05 100644
--- a/src/option.c
+++ b/src/option.c
@@ -65,6 +65,7 @@ static struct {
    {N_("shell &Patterns"),    &easy_patterns,     TOGGLE_VARIABLE,       0 },
    {N_("Compute &Totals"),    &file_op_compute_totals, TOGGLE_VARIABLE,  0 },
    {N_("&Verbose operation"), &verbose,           TOGGLE_VARIABLE,       0 },
+   {N_("Mkdir autoname"),     &auto_fill_mkdir_name, TOGGLE_VARIABLE,    0 },
    /* panel options */
    {N_("&Fast dir reload"),   &fast_reload,       toggle_fast_reload,    0 },
    {N_("mi&X all files"),     &mix_all_files,     toggle_mix_all_files,  0 },
@@ -76,7 +77,7 @@ static struct {
 };
 
 /* Make sure this corresponds to the check_options structure */
-#define OTHER_OPTIONS 12
+#define OTHER_OPTIONS 13
 #define PANEL_OPTIONS 6
 
 static WRadio *pause_radio;
diff --git a/src/setup.c b/src/setup.c
index 3e24e60..e806f10 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -223,6 +223,7 @@ static const struct {
     { "nice_rotating_dash", &nice_rotating_dash },
     { "horizontal_split",   &horizontal_split },
     { "mcview_remember_file_position", &mcview_remember_file_position },
+    { "auto_fill_mkdir_name", &auto_fill_mkdir_name },
     { 0, 0 }
 };
 

-- 
Midnight Commander Development



More information about the mc-devel mailing list