diff -urp mc-4.8.13.orig/doc/man/mc.1.in mc-4.8.13/doc/man/mc.1.in
old
|
new
|
unintentionally becomes more difficult. |
1957 | 1957 | confirmation dialogs for deletion changes from "Yes" to "No". |
1958 | 1958 | This option is disabled by default. |
1959 | 1959 | .PP |
| 1960 | .I Auto cd new terminal. |
| 1961 | If this option is enabled, mc tells its current directory to the terminal. |
| 1962 | Some graphical terminals use this information to open new windows or tabs |
| 1963 | in that directory. |
| 1964 | .PP |
1960 | 1965 | .I Auto save setup. |
1961 | 1966 | If this option is enabled, when you exit the Midnight Commander the |
1962 | 1967 | configurable options of the Midnight Commander are saved in the |
diff -urp mc-4.8.13.orig/src/execute.c mc-4.8.13/src/execute.c
old
|
new
|
do_executev (const char *shell, int flag |
370 | 370 | { |
371 | 371 | update_panels (UP_OPTIMIZE, UP_KEEPSEL); |
372 | 372 | update_xterm_title_path (); |
| 373 | update_terminal_cwd (); |
373 | 374 | } |
374 | 375 | |
375 | 376 | do_refresh (); |
… |
… |
toggle_panels (void) |
558 | 559 | { |
559 | 560 | update_panels (UP_OPTIMIZE, UP_KEEPSEL); |
560 | 561 | update_xterm_title_path (); |
| 562 | update_terminal_cwd (); |
561 | 563 | } |
562 | 564 | |
563 | 565 | if (was_sigwinch != 0 || mc_global.tty.winch_flag != 0) |
diff -urp mc-4.8.13.orig/src/filemanager/boxes.c mc-4.8.13/src/filemanager/boxes.c
old
|
new
|
configure_box (void) |
478 | 478 | QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL), |
479 | 479 | QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL), |
480 | 480 | QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL), |
| 481 | QUICK_CHECKBOX (N_("Auto cd new terminal"), &auto_cd_new_terminal, NULL), // TODO: shortcut key! |
481 | 482 | QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL), |
482 | 483 | QUICK_SEPARATOR (FALSE), |
483 | 484 | QUICK_SEPARATOR (FALSE), |
diff -urp mc-4.8.13.orig/src/filemanager/layout.c mc-4.8.13/src/filemanager/layout.c
old
|
new
|
setup_panels (void) |
753 | 753 | widget_set_size (WIDGET (the_hint), 0, 0, 0, 0); |
754 | 754 | |
755 | 755 | update_xterm_title_path (); |
| 756 | update_terminal_cwd (); |
756 | 757 | } |
757 | 758 | |
758 | 759 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
update_xterm_title_path (void) |
1406 | 1407 | } |
1407 | 1408 | } |
1408 | 1409 | |
| 1410 | /* --------------------------------------------------------------------------------------------- */ |
| 1411 | |
| 1412 | /** Tell the current directory to the terminal, so it can open a new tab there */ |
| 1413 | void |
| 1414 | update_terminal_cwd (void) |
| 1415 | { |
| 1416 | if (mc_global.tty.xterm_flag && auto_cd_new_terminal && vfs_current_is_local ()) |
| 1417 | { |
| 1418 | char host[BUF_TINY]; |
| 1419 | int res = 0; |
| 1420 | char *path; |
| 1421 | int pathlen, i; |
| 1422 | unsigned char c; |
| 1423 | |
| 1424 | path = vfs_path_to_str_flags (current_panel->cwd_vpath, 0, VPF_NONE); |
| 1425 | pathlen = strlen (path); |
| 1426 | |
| 1427 | res = gethostname (host, sizeof (host)); |
| 1428 | if (res != 0) |
| 1429 | host[0] = '\0'; |
| 1430 | else |
| 1431 | host[sizeof (host) - 1] = '\0'; |
| 1432 | |
| 1433 | fprintf (stdout, "\33]7;file://%s", host); |
| 1434 | for (i = 0; i < pathlen; i++) { |
| 1435 | c = path[i]; |
| 1436 | if ((c >= '0' && c <= '9') || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z') || index("/_.-()~", c) != NULL) |
| 1437 | fprintf(stdout, "%c", c); |
| 1438 | else |
| 1439 | fprintf(stdout, "%%%02X", c); |
| 1440 | } |
| 1441 | fprintf (stdout, "\7"); |
| 1442 | (void) fflush (stdout); |
| 1443 | g_free (path); |
| 1444 | } |
| 1445 | } |
| 1446 | |
1409 | 1447 | /* --------------------------------------------------------------------------------------------- */ |
diff -urp mc-4.8.13.orig/src/filemanager/layout.h mc-4.8.13/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.13.orig/src/filemanager/panel.c mc-4.8.13/src/filemanager/panel.c
old
|
new
|
_do_panel_cd (WPanel * panel, const vfs_ |
3202 | 3202 | load_hint (0); |
3203 | 3203 | panel->dirty = 1; |
3204 | 3204 | update_xterm_title_path (); |
| 3205 | update_terminal_cwd (); |
3205 | 3206 | |
3206 | 3207 | vfs_path_free (olddir_vpath); |
3207 | 3208 | |
… |
… |
panel_callback (Widget * w, Widget * sen |
3566 | 3567 | subshell_chdir (panel->cwd_vpath); |
3567 | 3568 | |
3568 | 3569 | update_xterm_title_path (); |
| 3570 | update_terminal_cwd (); |
3569 | 3571 | select_item (panel); |
3570 | 3572 | show_dir (panel); |
3571 | 3573 | paint_dir (panel); |
diff -urp mc-4.8.13.orig/src/setup.c mc-4.8.13/src/setup.c
old
|
new
|
int confirm_view_dir = 0; |
114 | 114 | /* Ask file name before start the editor */ |
115 | 115 | int editor_ask_filename_before_edit = 0; |
116 | 116 | |
| 117 | /* Tell cwd to the terminal so it can open new tabs there */ |
| 118 | int auto_cd_new_terminal = 0; |
| 119 | |
117 | 120 | panel_view_mode_t startup_left_mode; |
118 | 121 | panel_view_mode_t startup_right_mode; |
119 | 122 | |
… |
… |
static const struct |
363 | 366 | { "mcview_remember_file_position", &mcview_remember_file_position }, |
364 | 367 | { "auto_fill_mkdir_name", &auto_fill_mkdir_name }, |
365 | 368 | { "copymove_persistent_attr", &setup_copymove_persistent_attr }, |
| 369 | { "auto_cd_new_terminal", &auto_cd_new_terminal }, |
366 | 370 | { NULL, NULL } |
367 | 371 | }; |
368 | 372 | |
diff -urp mc-4.8.13.orig/src/setup.h mc-4.8.13/src/setup.h
old
|
new
|
extern int output_starts_shell; |
97 | 97 | extern int use_file_to_check_type; |
98 | 98 | extern int file_op_compute_totals; |
99 | 99 | extern int editor_ask_filename_before_edit; |
| 100 | extern int auto_cd_new_terminal; |
100 | 101 | |
101 | 102 | extern panels_options_t panels_options; |
102 | 103 | |