From 2ce1b9955ce54db46fd2a09dcf04245f93197607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 29 Aug 2021 18:36:58 +0200 Subject: [PATCH] Signal CWD change to terminal via OSC-7 Closes #1147 --- src/nnn.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index 146acbbbe..fbadd240f 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -6424,7 +6424,7 @@ static bool browse(char *ipath, const char *session, int pkey) char newpath[PATH_MAX] __attribute__ ((aligned)), rundir[PATH_MAX] __attribute__ ((aligned)), runfile[NAME_MAX + 1] __attribute__ ((aligned)); - char *path, *lastdir, *lastname, *dir, *tmp; + char *path, *lastdir, *lastname, *dir, *tmp, hostname[_POSIX_HOST_NAME_MAX]; pEntry pent; enum action sel; struct stat sb; @@ -6501,6 +6501,11 @@ static bool browse(char *ipath, const char *session, int pkey) setdirwatch(); } + /* Signal CWD change to terminal */ + gethostname(hostname, sizeof(hostname)); + printf("\033]7;file://%s%s\033\\", hostname, path); + fflush(stdout); + #ifndef NOX11 if (cfg.x11 && !g_state.picker) { /* Set terminal window title */