diff --git a/osc.c b/osc.c index 45d114de..94dd06c1 100644 --- a/osc.c +++ b/osc.c @@ -415,28 +415,6 @@ parse_rgb(const char *string, uint32_t *color, bool *_have_alpha, return true; } -static void -osc_set_pwd(struct terminal *term, char *string) -{ - LOG_DBG("PWD: URI: %s", string); - - char *scheme, *host, *path; - if (!uri_parse(string, strlen(string), &scheme, NULL, NULL, &host, NULL, &path, NULL, NULL)) { - LOG_ERR("OSC7: invalid URI: %s", string); - return; - } - - if (strcmp(scheme, "file") == 0 && hostname_is_localhost(host)) { - LOG_DBG("OSC7: pwd: %s", path); - free(term->cwd); - term->cwd = path; - } else - free(path); - - free(scheme); - free(host); -} - static void osc_uri(struct terminal *term, char *string) { @@ -662,11 +640,6 @@ osc_dispatch(struct terminal *term) break; } - case 7: - /* Update terminal's understanding of PWD */ - osc_set_pwd(term, string); - break; - case 8: osc_uri(term, string); break; diff --git a/terminal.c b/terminal.c index dd4c627c..209d05d2 100644 --- a/terminal.c +++ b/terminal.c @@ -3302,8 +3302,11 @@ term_bell(struct terminal *term) bool term_spawn_new(const struct terminal *term) { + char buf[32]; + snprintf(buf, sizeof(buf), "/proc/%d/cwd", term->slave); + return spawn( - term->reaper, term->cwd, (char *const []){term->foot_exe, NULL}, + term->reaper, realpath(buf, NULL), (char *const []){term->foot_exe, NULL}, -1, -1, -1, NULL); }