Patch for mc git version (4.8.0, 2011-04-03):
Changes default copy/move destination to source entry name
instead of target directory name when operating on single entry.
It allows to rename files conveniently.
diff --git a/src/filemanager/file.c b/src/filemanager/file.c
index d74c79e..6ebbf3f 100644
a
|
b
|
panel_operate (void *source_panel, FileOperation operation, gboolean force_singl |
2349 | 2349 | if (operation != OP_DELETE) |
2350 | 2350 | { |
2351 | 2351 | char *dest_dir; |
2352 | | char *dest_dir_; |
| 2352 | char *dest_dir_ = NULL; |
2353 | 2353 | char *format; |
2354 | 2354 | |
2355 | 2355 | /* Forced single operations default to the original name */ |
2356 | | if (force_single) |
| 2356 | if (force_single || single_entry && !strcmp(panel->cwd, other_panel->cwd)) |
| 2357 | { |
2357 | 2358 | dest_dir = source; |
| 2359 | dest_dir_ = source; /* hack... */ |
| 2360 | } |
2358 | 2361 | else if (get_other_type () == view_listing) |
2359 | 2362 | dest_dir = other_panel->cwd; |
2360 | 2363 | else |
… |
… |
panel_operate (void *source_panel, FileOperation operation, gboolean force_singl |
2364 | 2367 | * It saves user from occasional file renames (when destination |
2365 | 2368 | * dir is deleted) |
2366 | 2369 | */ |
2367 | | if (!force_single && dest_dir[0] != '\0' && dest_dir[strlen (dest_dir) - 1] != PATH_SEP) |
| 2370 | if (!dest_dir_ && !force_single && dest_dir[0] != '\0' && dest_dir[strlen (dest_dir) - 1] != PATH_SEP) |
2368 | 2371 | { |
2369 | 2372 | /* add trailing separator */ |
2370 | 2373 | dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR, (char *) NULL); |