diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-31 16:47:06 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-31 16:47:06 -0500 |
commit | 4293406c06fbd5572d25d86398c2c2e279ff5118 (patch) | |
tree | ca51ed28d9bff16bebe1520d17549467188cc705 /config.c | |
parent | 3f22228a220d065af3f99ba6a538ff80517ecaa2 (diff) |
core settings
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -9,6 +9,7 @@ typedef enum { SECTION_NONE, + SECTION_CORE, SECTION_KEYBOARD, SECTION_COLORS } Section; @@ -179,6 +180,8 @@ void config_read(Ted *ted, char const *filename) { section = SECTION_KEYBOARD; } else if (streq(section_name, "colors")) { section = SECTION_COLORS; + } else if (streq(section_name, "core")) { + section = SECTION_CORE; } else { config_err(cfg, "Unrecognized section: [%s].", section_name); } @@ -251,6 +254,32 @@ void config_read(Ted *ted, char const *filename) { config_err(cfg, "Expected ':' for key action. This line should look something like: %s = :command.", key); } } break; + case SECTION_CORE: + if (streq(key, "tab-width")) { + int n = atoi(value); + if (n > 0 && n < 100) { + settings->tab_width = (u8)n; + } else { + config_err(cfg, "Invalid tab width: %s.", value); + } + } else if (streq(key, "cursor-width")) { + int n = atoi(value); + if (n > 0 && n < 100) { + settings->cursor_width = (u8)n; + } else { + config_err(cfg, "Invalid cursor width: %s.", value); + } + } else if (streq(key, "undo-save-time")) { + int n = atoi(value); + if (n > 0 && n < 200) { + settings->undo_save_time = (u8)n; + } else { + config_err(cfg, "Invalid undo save time: %s.", value); + } + } else { + config_err(cfg, "Unrecognized core setting: %s.", key); + } + break; } } } else { |