54154: extract function for URL-encoding and writing to TTY

This commit is contained in:
Johannes Altmanninger
2026-01-09 12:24:38 +01:00
committed by Oliver Kiddle
parent c8923e69da
commit 6c67981033
2 changed files with 12 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
2026-04-05 Oliver Kiddle <opk@zsh.org>
* Johannes Altmanninger: 54154: Src/Zle/termquery.c:
extract function for URL-encoding and writing to TTY
* 54276: Completion/Unix/Command/_zfs: fix to add full list
of compression algorithms as completion matches

View File

@@ -765,20 +765,24 @@ mark_output(int start)
(start ? sizeof(START) : sizeof(END)) - 1);
}
static void
write_urlencoded(const char *path_components)
{
size_t enc_len;
const char *enc = url_encode(path_components, &enc_len);
write_loop(SHTTY, enc, enc_len);
}
/**/
void
notify_pwd(void)
{
char *url;
size_t ulen;
if (!extension_enabled("integration", "pwd", 11, 1))
return;
url = url_encode(pwd, &ulen);
/* only "localhost" seems to be much use here as the host */
write_loop(SHTTY, "\033]7;file://localhost", 20);
write_loop(SHTTY, url, ulen);
write_urlencoded(pwd);
write_loop(SHTTY, "\033\\", 2);
}