aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-15 18:00:56 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-15 18:00:56 +0000
commit9ab9247b88be94e222add13d5bb93d34f02281d1 (patch)
treeee5d3aafef0c328737316b48d4ac8bd80d59ed3d
parentMerge branch 'text-reflow-fixes' (diff)
config: add 'pad' option, default to 2
-rw-r--r--config.c15
-rw-r--r--config.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/config.c b/config.c
index 80e0e868..1dd6652f 100644
--- a/config.c
+++ b/config.c
@@ -172,6 +172,19 @@ parse_section_main(const char *key, const char *value, struct config *conf,
conf->height = height;
}
+ else if (strcmp(key, "pad") == 0) {
+ unsigned x, y;
+ if (sscanf(value, "%ux%u", &x, &y) != 2) {
+ LOG_ERR(
+ "%s: %d: expected PAD_XxPAD_Y, where both are positive integers: %s",
+ path, lineno, value);
+ return false;
+ }
+
+ conf->pad_x = x;
+ conf->pad_y = y;
+ }
+
else if (strcmp(key, "font") == 0) {
char *copy = strdup(value);
for (const char *font = strtok(copy, ","); font != NULL; font = strtok(NULL, ",")) {
@@ -472,6 +485,8 @@ config_load(struct config *conf, const char *conf_path)
.shell = get_shell(),
.width = -1,
.height = -1,
+ .pad_x = 2,
+ .pad_y = 2,
.fonts = tll_init(),
.scrollback_lines = 1000,
diff --git a/config.h b/config.h
index 2fb82151..90376fc0 100644
--- a/config.h
+++ b/config.h
@@ -12,6 +12,8 @@ struct config {
char *shell;
unsigned width;
unsigned height;
+ unsigned pad_x;
+ unsigned pad_y;
tll(char *) fonts;