From 07d1cfef611562b77b41b50c0fb533e412b3814d Mon Sep 17 00:00:00 2001
From: Mikhail S. Pobolovets <styx.mp@gmail.com>
Date: Thu, 22 Jan 2009 23:29:10 +0200
Subject: [PATCH] Signed-off-by: Mikhail S. Pobolovets <styx.mp@gmail.com>
Automatic new directory(Mkdir, F7) name filling.
Can be configured (on|off) in 'Configure options'.
---
src/cmd.c | 11 ++++++++++-
src/main.h | 1 +
src/option.c | 3 ++-
src/setup.c | 1 +
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/cmd.c b/src/cmd.c
index fca2816..67eadd0 100644
a
|
b
|
int output_starts_shell = 0; |
76 | 76 | /* If set, use the builtin editor */ |
77 | 77 | int use_internal_edit = 1; |
78 | 78 | |
| 79 | /* Automatically fills name with current selected item name on mkdir */ |
| 80 | int auto_fill_mkdir_name = 1; |
79 | 81 | |
80 | 82 | int |
81 | 83 | view_file_at_line (const char *filename, int plain_view, int internal, |
… |
… |
void |
347 | 349 | mkdir_cmd (void) |
348 | 350 | { |
349 | 351 | char *dir, *absdir; |
| 352 | char *name = ""; |
| 353 | |
| 354 | /* If 'on' then automatically fills name with current selected item name */ |
| 355 | if (auto_fill_mkdir_name) |
| 356 | name = selection (current_panel)->fname; |
350 | 357 | |
351 | 358 | dir = |
352 | 359 | input_expand_dialog (_("Create a new Directory"), |
353 | | _(" Enter directory name:"), ""); |
| 360 | _(" Enter directory name:"), |
| 361 | name); |
| 362 | |
354 | 363 | if (!dir) |
355 | 364 | return; |
356 | 365 | |
diff --git a/src/main.h b/src/main.h
index fb38e7a..1500548 100644
a
|
b
|
extern int output_starts_shell; |
71 | 71 | extern int midnight_shutdown; |
72 | 72 | extern char cmd_buf [512]; |
73 | 73 | extern const char *shell; |
| 74 | extern int auto_fill_mkdir_name; |
74 | 75 | |
75 | 76 | /* Ugly hack in order to distinguish between left and right panel in menubar */ |
76 | 77 | 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
|
b
|
static struct { |
65 | 65 | {N_("shell &Patterns"), &easy_patterns, TOGGLE_VARIABLE, 0 }, |
66 | 66 | {N_("Compute &Totals"), &file_op_compute_totals, TOGGLE_VARIABLE, 0 }, |
67 | 67 | {N_("&Verbose operation"), &verbose, TOGGLE_VARIABLE, 0 }, |
| 68 | {N_("Mkdir autoname"), &auto_fill_mkdir_name, TOGGLE_VARIABLE, 0 }, |
68 | 69 | /* panel options */ |
69 | 70 | {N_("&Fast dir reload"), &fast_reload, toggle_fast_reload, 0 }, |
70 | 71 | {N_("mi&X all files"), &mix_all_files, toggle_mix_all_files, 0 }, |
… |
… |
static struct { |
76 | 77 | }; |
77 | 78 | |
78 | 79 | /* Make sure this corresponds to the check_options structure */ |
79 | | #define OTHER_OPTIONS 12 |
| 80 | #define OTHER_OPTIONS 13 |
80 | 81 | #define PANEL_OPTIONS 6 |
81 | 82 | |
82 | 83 | static WRadio *pause_radio; |
diff --git a/src/setup.c b/src/setup.c
index f26566a..865fa4c 100644
a
|
b
|
static const struct { |
223 | 223 | { "nice_rotating_dash", &nice_rotating_dash }, |
224 | 224 | { "horizontal_split", &horizontal_split }, |
225 | 225 | { "mcview_remember_file_position", &mcview_remember_file_position }, |
| 226 | { "auto_fill_mkdir_name", &auto_fill_mkdir_name }, |
226 | 227 | { 0, 0 } |
227 | 228 | }; |
228 | 229 | |