mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-28 06:46:38 -04:00
implement st's newterm instead of osc 7
This commit is contained in:
parent
b4e418f251
commit
9ae89c74cb
2 changed files with 4 additions and 28 deletions
27
osc.c
27
osc.c
|
|
@ -415,28 +415,6 @@ parse_rgb(const char *string, uint32_t *color, bool *_have_alpha,
|
||||||
return true;
|
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
|
static void
|
||||||
osc_uri(struct terminal *term, char *string)
|
osc_uri(struct terminal *term, char *string)
|
||||||
{
|
{
|
||||||
|
|
@ -662,11 +640,6 @@ osc_dispatch(struct terminal *term)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 7:
|
|
||||||
/* Update terminal's understanding of PWD */
|
|
||||||
osc_set_pwd(term, string);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
osc_uri(term, string);
|
osc_uri(term, string);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -3302,8 +3302,11 @@ term_bell(struct terminal *term)
|
||||||
bool
|
bool
|
||||||
term_spawn_new(const struct terminal *term)
|
term_spawn_new(const struct terminal *term)
|
||||||
{
|
{
|
||||||
|
char buf[32];
|
||||||
|
snprintf(buf, sizeof(buf), "/proc/%d/cwd", term->slave);
|
||||||
|
|
||||||
return spawn(
|
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);
|
-1, -1, -1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue