mirror of https://github.com/MidnightCommander/mc
Merge branch '3088_terminal_cwd'
* 3088_terminal_cwd: Use ESC_STR macro in escape sequences. (update_xterm_title_path): change the escape sequence's terminator Ticket #3088: tell the current directory to the terminal
This commit is contained in:
commit
6b44fce839
|
@ -373,6 +373,7 @@ do_executev (const char *shell, int flags, char *const argv[])
|
|||
{
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
update_xterm_title_path ();
|
||||
update_terminal_cwd ();
|
||||
}
|
||||
|
||||
do_refresh ();
|
||||
|
@ -567,6 +568,7 @@ toggle_subshell (void)
|
|||
{
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
update_xterm_title_path ();
|
||||
update_terminal_cwd ();
|
||||
}
|
||||
|
||||
if (was_sigwinch != 0 || tty_got_winch ())
|
||||
|
|
|
@ -913,6 +913,7 @@ setup_panels (void)
|
|||
widget_set_visibility (WIDGET (the_bar), mc_global.keybar_visible);
|
||||
|
||||
update_xterm_title_path ();
|
||||
update_terminal_cwd ();
|
||||
|
||||
/* unlock */
|
||||
if (active)
|
||||
|
@ -1567,7 +1568,7 @@ update_xterm_title_path (void)
|
|||
g_free (login);
|
||||
g_free (path);
|
||||
|
||||
fprintf (stdout, "\33]0;%s\7", str_term_form (p));
|
||||
fprintf (stdout, ESC_STR "]0;%s" ESC_STR "\\", str_term_form (p));
|
||||
g_free (p);
|
||||
|
||||
if (!mc_global.tty.alternate_plus_minus)
|
||||
|
@ -1577,3 +1578,26 @@ update_xterm_title_path (void)
|
|||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/** Tell the current directory to the terminal so it can open new tabs there */
|
||||
void
|
||||
update_terminal_cwd (void)
|
||||
{
|
||||
if (mc_global.tty.xterm_flag && vfs_current_is_local ())
|
||||
{
|
||||
const gchar *host;
|
||||
char *path, *path_uri;
|
||||
|
||||
host = g_get_host_name ();
|
||||
path = vfs_path_to_str_flags (current_panel->cwd_vpath, 0, VPF_NONE);
|
||||
path_uri = g_uri_escape_string (path, "/", FALSE);
|
||||
|
||||
fprintf (stdout, ESC_STR "]7;file://%s%s" ESC_STR "\\", host, path_uri);
|
||||
(void) fflush (stdout);
|
||||
|
||||
g_free (path_uri);
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -90,6 +90,7 @@ int load_prompt (int fd, void *unused);
|
|||
#endif
|
||||
|
||||
void update_xterm_title_path (void);
|
||||
void update_terminal_cwd (void);
|
||||
|
||||
void title_path_prepare (char **path, char **login);
|
||||
|
||||
|
|
|
@ -3436,6 +3436,7 @@ panel_do_cd_int (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum
|
|||
load_hint (FALSE);
|
||||
panel->dirty = TRUE;
|
||||
update_xterm_title_path ();
|
||||
update_terminal_cwd ();
|
||||
|
||||
vfs_path_free (olddir_vpath, TRUE);
|
||||
|
||||
|
@ -3823,6 +3824,7 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
|||
subshell_chdir (panel->cwd_vpath);
|
||||
|
||||
update_xterm_title_path ();
|
||||
update_terminal_cwd ();
|
||||
select_item (panel);
|
||||
|
||||
bb = buttonbar_find (h);
|
||||
|
|
Loading…
Reference in New Issue