mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
config: trim leading spaces from fonts
When splitting the font configuration into multiple font specifications, we now trim leading spaces. This makes no actual difference; fontconfig matched the fonts just fine anyway, but this looks better in the logs.
This commit is contained in:
parent
0f8fcad26f
commit
6da88ddf01
1 changed files with 7 additions and 2 deletions
9
config.c
9
config.c
|
|
@ -174,8 +174,13 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
|||
|
||||
else if (strcmp(key, "font") == 0) {
|
||||
char *copy = strdup(value);
|
||||
for (const char *font = strtok(copy, ","); font != NULL; font = strtok(NULL, ","))
|
||||
tll_push_back(conf->fonts, strdup(font));
|
||||
for (const char *font = strtok(copy, ","); font != NULL; font = strtok(NULL, ",")) {
|
||||
/* Trim spaces, strictly speaking not necessary, but looks nice :) */
|
||||
while (*font != '\0' && isspace(*font))
|
||||
font++;
|
||||
if (*font != '\0')
|
||||
tll_push_back(conf->fonts, strdup(font));
|
||||
}
|
||||
free(copy);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue