aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-04 07:30:40 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-04 07:30:40 +0000
commit07f000fa453dc455a343c8ba28418707b04326dc (patch)
tree498889333d3f16951214cba73c5e9d565efee3f1
parentMerge branch 'macros' (diff)
parentAdd myself to Contributors (diff)
Merge branch 'blank-before-trailing-comment'
Closes #270
-rw-r--r--CHANGELOG.md5
-rw-r--r--config.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6623242f..5c3391eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,8 @@
instead of needing to be manually cloned.
* Box drawing characters are now rendered by foot, instead of using
font glyphs (https://codeberg.org/dnkl/foot/issues/198)
+* Trailing comments in `foot.ini` must now be preceded by a space or tab
+ (https://codeberg.org/dnkl/foot/issues/270)
### Deprecated
@@ -43,6 +45,8 @@
* Erased, overflowing glyphs (when
`tweak.allow-overflowing-double-width-glyphs=yes` - the default) not
properly erasing the cell overflowed **into**.
+* `word-delimiters` option ignores `#` and subsequent characters
+ (https://codeberg.org/dnkl/foot/issues/270)
### Security
@@ -50,6 +54,7 @@
* [craigbarnes](https://codeberg.org/craigbarnes)
* [birger](https://codeberg.org/birger)
+* [pc](https://codeberg.org/pc)
## 1.6.2
diff --git a/config.c b/config.c
index bf184a16..883cf27c 100644
--- a/config.c
+++ b/config.c
@@ -1731,9 +1731,18 @@ parse_config_file(FILE *f, struct config *conf, const char *path, bool errors_ar
if (line[0] == '\0' || line[0] == '#')
continue;
- /* Split up into key/value pair + trailing comment */
- char *key_value = strtok(line, "#");
- char UNUSED *comment = strtok(NULL, "\n");
+ /* Split up into key/value pair + trailing comment separated by blank */
+ char *key_value = line;
+ char *comment = line;
+ while (comment[0] != '\0') {
+ const char c = comment[0];
+ comment++;
+ if (isblank(c) && comment[0] == '#') {
+ comment[0] = '\0'; /* Terminate key/value pair */
+ comment++;
+ break;
+ }
+ }
/* Check for new section */
if (key_value[0] == '[') {