diff -urp mc-4.8.10.orig/doc/man/mc.1.in mc-4.8.10/doc/man/mc.1.in
old
|
new
|
unintentionally becomes more difficult. |
1950 | 1950 | confirmation dialogs for deletion changes from "Yes" to "No". |
1951 | 1951 | This option is disabled by default. |
1952 | 1952 | .PP |
| 1953 | .I Auto cd new terminal. |
| 1954 | If this option is enabled, mc tells its current directory to the terminal. |
| 1955 | Some graphical terminals use this information to open new windows or tabs |
| 1956 | in that directory. |
| 1957 | .PP |
1953 | 1958 | .I Auto save setup. |
1954 | 1959 | If this option is enabled, when you exit the Midnight Commander the |
1955 | 1960 | configurable options of the Midnight Commander are saved in the |
diff -urp mc-4.8.10.orig/src/execute.c mc-4.8.10/src/execute.c
old
|
new
|
do_executev (const char *shell, int flag |
363 | 363 | { |
364 | 364 | update_panels (UP_OPTIMIZE, UP_KEEPSEL); |
365 | 365 | update_xterm_title_path (); |
| 366 | update_terminal_cwd (); |
366 | 367 | } |
367 | 368 | |
368 | 369 | do_refresh (); |
… |
… |
toggle_panels (void) |
548 | 549 | { |
549 | 550 | update_panels (UP_OPTIMIZE, UP_KEEPSEL); |
550 | 551 | update_xterm_title_path (); |
| 552 | update_terminal_cwd (); |
551 | 553 | } |
552 | 554 | |
553 | 555 | if (was_sigwinch != 0 || mc_global.tty.winch_flag != 0) |
diff -urp mc-4.8.10.orig/src/filemanager/boxes.c mc-4.8.10/src/filemanager/boxes.c
old
|
new
|
configure_box (void) |
476 | 476 | QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL), |
477 | 477 | QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL), |
478 | 478 | QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL), |
| 479 | QUICK_CHECKBOX (N_("Auto cd new terminal"), &auto_cd_new_terminal, NULL), // TODO: shortcut key! |
479 | 480 | QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL), |
480 | 481 | QUICK_SEPARATOR (FALSE), |
481 | 482 | QUICK_SEPARATOR (FALSE), |
diff -urp mc-4.8.10.orig/src/filemanager/layout.c mc-4.8.10/src/filemanager/layout.c
old
|
new
|
setup_panels (void) |
757 | 757 | widget_set_size (WIDGET (the_hint), 0, 0, 0, 0); |
758 | 758 | |
759 | 759 | update_xterm_title_path (); |
| 760 | update_terminal_cwd (); |
760 | 761 | } |
761 | 762 | |
762 | 763 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
update_xterm_title_path (void) |
1408 | 1409 | } |
1409 | 1410 | } |
1410 | 1411 | |
| 1412 | /* --------------------------------------------------------------------------------------------- */ |
| 1413 | |
| 1414 | /** Tell the current directory to the terminal, so it can open a new tab there */ |
| 1415 | void |
| 1416 | update_terminal_cwd (void) |
| 1417 | { |
| 1418 | if (mc_global.tty.xterm_flag && auto_cd_new_terminal && vfs_current_is_local ()) |
| 1419 | { |
| 1420 | char host[BUF_TINY]; |
| 1421 | int res = 0; |
| 1422 | char *path; |
| 1423 | int pathlen, i; |
| 1424 | unsigned char c; |
| 1425 | |
| 1426 | path = vfs_path_to_str_flags (current_panel->cwd_vpath, 0, VPF_NONE); |
| 1427 | pathlen = strlen (path); |
| 1428 | |
| 1429 | res = gethostname (host, sizeof (host)); |
| 1430 | if (res != 0) |
| 1431 | host[0] = '\0'; |
| 1432 | else |
| 1433 | host[sizeof (host) - 1] = '\0'; |
| 1434 | |
| 1435 | fprintf (stdout, "\33]7;file://%s", host); |
| 1436 | for (i = 0; i < pathlen; i++) { |
| 1437 | c = path[i]; |
| 1438 | if ((c >= '0' && c <= '9') || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z') || index("/_.-()~", c) != NULL) |
| 1439 | fprintf(stdout, "%c", c); |
| 1440 | else |
| 1441 | fprintf(stdout, "%%%02X", c); |
| 1442 | } |
| 1443 | fprintf (stdout, "\7"); |
| 1444 | (void) fflush (stdout); |
| 1445 | g_free (path); |
| 1446 | } |
| 1447 | } |
| 1448 | |
1411 | 1449 | /* --------------------------------------------------------------------------------------------- */ |
diff -urp mc-4.8.10.orig/src/filemanager/layout.h mc-4.8.10/src/filemanager/layout.h
old
|
new
|
int load_prompt (int fd, void *unused); |
87 | 87 | #endif |
88 | 88 | |
89 | 89 | void update_xterm_title_path (void); |
| 90 | void update_terminal_cwd (void); |
90 | 91 | |
91 | 92 | void title_path_prepare (char **path, char **login); |
92 | 93 | |
diff -urp mc-4.8.10.orig/src/filemanager/panel.c mc-4.8.10/src/filemanager/panel.c
old
|
new
|
_do_panel_cd (WPanel * panel, const vfs_ |
3072 | 3072 | load_hint (0); |
3073 | 3073 | panel->dirty = 1; |
3074 | 3074 | update_xterm_title_path (); |
| 3075 | update_terminal_cwd (); |
3075 | 3076 | |
3076 | 3077 | vfs_path_free (olddir_vpath); |
3077 | 3078 | |
… |
… |
panel_callback (Widget * w, Widget * sen |
3436 | 3437 | subshell_chdir (panel->cwd_vpath); |
3437 | 3438 | |
3438 | 3439 | update_xterm_title_path (); |
| 3440 | update_terminal_cwd (); |
3439 | 3441 | select_item (panel); |
3440 | 3442 | show_dir (panel); |
3441 | 3443 | paint_dir (panel); |
diff -urp mc-4.8.10.orig/src/setup.c mc-4.8.10/src/setup.c
old
|
new
|
int confirm_view_dir = 0; |
117 | 117 | /* Ask file name before start the editor */ |
118 | 118 | int editor_ask_filename_before_edit = 0; |
119 | 119 | |
| 120 | /* Tell cwd to the terminal so it can open new tabs there */ |
| 121 | int auto_cd_new_terminal = 0; |
| 122 | |
120 | 123 | panel_view_mode_t startup_left_mode; |
121 | 124 | panel_view_mode_t startup_right_mode; |
122 | 125 | |
… |
… |
static const struct |
365 | 368 | { "auto_fill_mkdir_name", &auto_fill_mkdir_name }, |
366 | 369 | { "copymove_persistent_attr", &setup_copymove_persistent_attr }, |
367 | 370 | { "select_flags", &select_flags }, |
| 371 | { "auto_cd_new_terminal", &auto_cd_new_terminal }, |
368 | 372 | { NULL, NULL } |
369 | 373 | }; |
370 | 374 | |
diff -urp mc-4.8.10.orig/src/setup.h mc-4.8.10/src/setup.h
old
|
new
|
extern int output_starts_shell; |
98 | 98 | extern int use_file_to_check_type; |
99 | 99 | extern int file_op_compute_totals; |
100 | 100 | extern int editor_ask_filename_before_edit; |
| 101 | extern int auto_cd_new_terminal; |
101 | 102 | |
102 | 103 | extern panels_options_t panels_options; |
103 | 104 | |