mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-06 07:15:30 -04:00
config: url.protocols: make it comma separated, for consistency
This commit is contained in:
parent
53516aceec
commit
121ea39942
3 changed files with 21 additions and 10 deletions
20
config.c
20
config.c
|
|
@ -1012,10 +1012,20 @@ parse_section_url(const char *key, const char *value, struct config *conf,
|
||||||
|
|
||||||
char *copy = xstrdup(value);
|
char *copy = xstrdup(value);
|
||||||
|
|
||||||
for (char *prot = strtok(copy, " ");
|
for (char *prot = strtok(copy, ",");
|
||||||
prot != NULL;
|
prot != NULL;
|
||||||
prot = strtok(NULL, " "))
|
prot = strtok(NULL, ","))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Strip leading whitespace */
|
||||||
|
while (isspace(*prot))
|
||||||
|
prot++;
|
||||||
|
|
||||||
|
/* Strip trailing whitespace */
|
||||||
|
size_t len = strlen(prot);
|
||||||
|
while (len > 0 && isspace(prot[len - 1]))
|
||||||
|
prot[--len] = '\0';
|
||||||
|
|
||||||
size_t chars = mbstowcs(NULL, prot, 0);
|
size_t chars = mbstowcs(NULL, prot, 0);
|
||||||
if (chars == (size_t)-1) {
|
if (chars == (size_t)-1) {
|
||||||
LOG_AND_NOTIFY_ERRNO(
|
LOG_AND_NOTIFY_ERRNO(
|
||||||
|
|
@ -1034,9 +1044,9 @@ parse_section_url(const char *key, const char *value, struct config *conf,
|
||||||
mbstowcs(conf->url.protocols[idx], prot, chars + 1);
|
mbstowcs(conf->url.protocols[idx], prot, chars + 1);
|
||||||
wcscpy(&conf->url.protocols[idx][chars], L"://");
|
wcscpy(&conf->url.protocols[idx][chars], L"://");
|
||||||
|
|
||||||
size_t len = chars + 3; /* Include the "://" */
|
chars += 3; /* Include the "://" */
|
||||||
if (len > conf->url.max_prot_len)
|
if (chars > conf->url.max_prot_len)
|
||||||
conf->url.max_prot_len = len;
|
conf->url.max_prot_len = chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(copy);
|
free(copy);
|
||||||
|
|
|
||||||
|
|
@ -324,10 +324,11 @@ in this order:
|
||||||
jump labels. Default: _sadfjklewcmpgh_.
|
jump labels. Default: _sadfjklewcmpgh_.
|
||||||
|
|
||||||
*protocols*
|
*protocols*
|
||||||
List of protocols (schemes) that should be recognized in URL
|
Comma separated list of protocols (schemes) that should be
|
||||||
mode. Note that only auto-detected URLs are affected by this
|
recognized in URL mode. Note that only auto-detected URLs are
|
||||||
option. OSC-8 URLs are always enabled, regardless of
|
affected by this option. OSC-8 URLs are always enabled, regardless
|
||||||
protocol. Default: _http https ftp ftps file gemini gopher_.
|
of protocol. Default: _http, https, ftp, ftps, file, gemini,
|
||||||
|
gopher_.
|
||||||
|
|
||||||
|
|
||||||
# SECTION: cursor
|
# SECTION: cursor
|
||||||
|
|
|
||||||
2
foot.ini
2
foot.ini
|
|
@ -45,7 +45,7 @@
|
||||||
# launch=xdg-open ${url}
|
# launch=xdg-open ${url}
|
||||||
# label-letters=sadfjklewcmpgh
|
# label-letters=sadfjklewcmpgh
|
||||||
# osc8-underline=url-mode
|
# osc8-underline=url-mode
|
||||||
# protocols = http https ftp ftps file gemini gopher
|
# protocols = http, https, ftp, ftps, file, gemini, gopher
|
||||||
|
|
||||||
[cursor]
|
[cursor]
|
||||||
# style=block
|
# style=block
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue