implement st's newterm instead of osc 7

This commit is contained in:
sewn 2023-05-28 05:44:02 +00:00
parent b4e418f251
commit 9ae89c74cb
2 changed files with 4 additions and 28 deletions

27
osc.c
View file

@ -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;

View file

@ -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);
}