diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in
index aad40fe27..06ea6af41 100644
a
|
b
|
to |
1876 | 1876 | .BR No . |
1877 | 1877 | This option is disabled by default. |
1878 | 1878 | .PP |
| 1879 | .I Auto cd new terminal. |
| 1880 | If this option is enabled, mc tells its current directory to the terminal. |
| 1881 | Some graphical terminal emulators use this information to open new windows |
| 1882 | or tabs in that directory. |
| 1883 | .PP |
1879 | 1884 | .I Auto save setup. |
1880 | 1885 | If this option is enabled, when you exit Midnight Commander, the |
1881 | 1886 | configurable options of Midnight Commander are saved in the |
diff --git a/po/be.po b/po/be.po
index d19484333..c7ed014e5 100644
Binary files a/po/be.po and b/po/be.po differ
diff --git a/po/br.po b/po/br.po
index 2811377a7..4de791b06 100644
Binary files a/po/br.po and b/po/br.po differ
diff --git a/po/hr.po b/po/hr.po
index 30389ce2a..de1f722a0 100644
Binary files a/po/hr.po and b/po/hr.po differ
diff --git a/src/execute.c b/src/execute.c
index 21095a20d..ad60ef96b 100644
a
|
b
|
do_executev (const char *shell, int flags, char *const argv[]) |
373 | 373 | { |
374 | 374 | update_panels (UP_OPTIMIZE, UP_KEEPSEL); |
375 | 375 | update_xterm_title_path (); |
| 376 | update_terminal_cwd (); |
376 | 377 | } |
377 | 378 | |
378 | 379 | do_refresh (); |
… |
… |
toggle_subshell (void) |
567 | 568 | { |
568 | 569 | update_panels (UP_OPTIMIZE, UP_KEEPSEL); |
569 | 570 | update_xterm_title_path (); |
| 571 | update_terminal_cwd (); |
570 | 572 | } |
571 | 573 | |
572 | 574 | if (was_sigwinch != 0 || tty_got_winch ()) |
diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
index 2dbc75d65..a6fc3f1d5 100644
a
|
b
|
configure_box (void) |
580 | 580 | &mc_global.widget.show_all_if_ambiguous, NULL), |
581 | 581 | QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL), |
582 | 582 | QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL), |
| 583 | QUICK_CHECKBOX (N_("Auto cd new terminal"), &auto_cd_new_terminal, NULL), /* w/o hotkey */ |
583 | 584 | QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL), |
584 | 585 | QUICK_CHECKBOX (N_("Safe overwrite"), &safe_overwrite, NULL), /* w/o hotkey */ |
585 | 586 | QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL), |
586 | 587 | QUICK_SEPARATOR (FALSE), |
587 | | QUICK_SEPARATOR (FALSE), |
588 | 588 | QUICK_STOP_GROUPBOX, |
589 | 589 | QUICK_STOP_COLUMNS, |
590 | 590 | QUICK_BUTTONS_OK_CANCEL, |
diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c
index 11607720d..bb1bd89d8 100644
a
|
b
|
setup_panels (void) |
913 | 913 | widget_set_visibility (WIDGET (the_bar), mc_global.keybar_visible); |
914 | 914 | |
915 | 915 | update_xterm_title_path (); |
| 916 | update_terminal_cwd (); |
916 | 917 | |
917 | 918 | /* unlock */ |
918 | 919 | if (active) |
… |
… |
update_xterm_title_path (void) |
1567 | 1568 | g_free (login); |
1568 | 1569 | g_free (path); |
1569 | 1570 | |
1570 | | fprintf (stdout, "\33]0;%s\7", str_term_form (p)); |
| 1571 | fprintf (stdout, "\33]0;%s\33\\", str_term_form (p)); |
1571 | 1572 | g_free (p); |
1572 | 1573 | |
1573 | 1574 | if (!mc_global.tty.alternate_plus_minus) |
… |
… |
update_xterm_title_path (void) |
1577 | 1578 | } |
1578 | 1579 | |
1579 | 1580 | /* --------------------------------------------------------------------------------------------- */ |
| 1581 | |
| 1582 | /** Tell the current directory to the terminal so it can open new tabs there */ |
| 1583 | void |
| 1584 | update_terminal_cwd (void) |
| 1585 | { |
| 1586 | if (mc_global.tty.xterm_flag && auto_cd_new_terminal && vfs_current_is_local ()) |
| 1587 | { |
| 1588 | const gchar *host; |
| 1589 | char *path; |
| 1590 | int pathlen, i; |
| 1591 | unsigned char c; |
| 1592 | |
| 1593 | host = g_get_host_name (); |
| 1594 | path = vfs_path_to_str_flags (current_panel->cwd_vpath, 0, VPF_NONE); |
| 1595 | pathlen = strlen (path); |
| 1596 | |
| 1597 | fprintf (stdout, "\33]7;file://%s", host); |
| 1598 | for (i = 0; i < pathlen; i++) { |
| 1599 | c = path[i]; |
| 1600 | if ((c >= '0' && c <= '9') || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z') || index("/_.-()~", c) != NULL) |
| 1601 | fprintf(stdout, "%c", c); |
| 1602 | else |
| 1603 | fprintf(stdout, "%%%02X", c); |
| 1604 | } |
| 1605 | fprintf (stdout, "\33\\"); |
| 1606 | (void) fflush (stdout); |
| 1607 | g_free (path); |
| 1608 | } |
| 1609 | } |
| 1610 | |
| 1611 | /* --------------------------------------------------------------------------------------------- */ |
diff --git a/src/filemanager/layout.h b/src/filemanager/layout.h
index 2566cfa32..685f2c371 100644
a
|
b
|
int load_prompt (int fd, void *unused); |
90 | 90 | #endif |
91 | 91 | |
92 | 92 | void update_xterm_title_path (void); |
| 93 | void update_terminal_cwd (void); |
93 | 94 | |
94 | 95 | void title_path_prepare (char **path, char **login); |
95 | 96 | |
diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
index b1174c0bf..f14fd38d7 100644
a
|
b
|
panel_do_cd_int (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum |
3436 | 3436 | load_hint (FALSE); |
3437 | 3437 | panel->dirty = TRUE; |
3438 | 3438 | update_xterm_title_path (); |
| 3439 | update_terminal_cwd (); |
3439 | 3440 | |
3440 | 3441 | vfs_path_free (olddir_vpath, TRUE); |
3441 | 3442 | |
… |
… |
panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d |
3823 | 3824 | subshell_chdir (panel->cwd_vpath); |
3824 | 3825 | |
3825 | 3826 | update_xterm_title_path (); |
| 3827 | update_terminal_cwd (); |
3826 | 3828 | select_item (panel); |
3827 | 3829 | |
3828 | 3830 | bb = buttonbar_find (h); |
diff --git a/src/setup.c b/src/setup.c
index 9d6e15348..b188de3e8 100644
a
|
b
|
gboolean confirm_view_dir = FALSE; |
112 | 112 | /* Ask file name before start the editor */ |
113 | 113 | gboolean editor_ask_filename_before_edit = FALSE; |
114 | 114 | |
| 115 | /* Tell cwd to the terminal so it can open new tabs there */ |
| 116 | gboolean auto_cd_new_terminal = TRUE; |
| 117 | |
115 | 118 | panel_view_mode_t startup_left_mode; |
116 | 119 | panel_view_mode_t startup_right_mode; |
117 | 120 | |
… |
… |
static const struct |
366 | 369 | { "mcview_remember_file_position", &mcview_remember_file_position }, |
367 | 370 | { "auto_fill_mkdir_name", &auto_fill_mkdir_name }, |
368 | 371 | { "copymove_persistent_attr", ©move_persistent_attr }, |
| 372 | { "auto_cd_new_terminal", &auto_cd_new_terminal }, |
369 | 373 | { NULL, NULL } |
370 | 374 | }; |
371 | 375 | |
diff --git a/src/setup.h b/src/setup.h
index b6e675d75..bbee32669 100644
a
|
b
|
extern gboolean use_file_to_check_type; |
100 | 100 | #endif |
101 | 101 | extern gboolean file_op_compute_totals; |
102 | 102 | extern gboolean editor_ask_filename_before_edit; |
| 103 | extern gboolean auto_cd_new_terminal; |
103 | 104 | |
104 | 105 | extern panels_options_t panels_options; |
105 | 106 | |