summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-02 13:02:38 -0400
committerpommicket <pommicket@gmail.com>2022-11-02 13:02:38 -0400
commit26d34216da04a2b91e65a0eeee9200ad808d48ce (patch)
treee9781ff976f16f1f5249ca679aa2c941a35eb03c /ted.c
parentb63bd066bf06317e6637aa03369a75c018c1939f (diff)
(insufficiently tested) per-path settings
also fixed memory bug in path_full, yet again
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/ted.c b/ted.c
index eba5aad..a3acfdd 100644
--- a/ted.c
+++ b/ted.c
@@ -52,6 +52,10 @@ Settings *ted_active_settings(Ted *ted) {
return ted->active_buffer ? buffer_settings(ted->active_buffer) : ted->settings;
}
+u32 ted_color(Ted *ted, ColorSetting color) {
+ return ted_active_settings(ted)->colors[color];
+}
+
static void ted_path_full(Ted *ted, char const *relpath, char *abspath, size_t abspath_size) {
path_full(ted->cwd, relpath, abspath, abspath_size);
}
@@ -372,20 +376,15 @@ void ted_load_configs(Ted *ted, bool reloading) {
}
}
- // read global settings
- config_read(ted, global_config_filename, 0);
- config_read(ted, local_config_filename, 0);
+
+ ConfigPart *parts = NULL;
+ config_read(ted, &parts, global_config_filename);
+ config_read(ted, &parts, local_config_filename);
if (ted->search_cwd) {
// read config in cwd
- config_read(ted, TED_CFG, 0);
+ config_read(ted, &parts, TED_CFG);
}
- // copy global settings to language-specific settings
- for (int l = 1; l < LANG_COUNT; ++l)
- ted->settings_by_language[l] = ted->settings_by_language[0];
- // read language-specific settings
- config_read(ted, global_config_filename, 1);
- config_read(ted, local_config_filename, 1);
- if (ted->search_cwd) config_read(ted, TED_CFG, 1);
+ config_parse(ted, &parts);
if (reloading) {
// reset text size