diff options
-rw-r--r-- | config.c | 9 | ||||
-rw-r--r-- | ted-internal.h | 4 | ||||
-rw-r--r-- | ted.c | 1 |
3 files changed, 10 insertions, 4 deletions
@@ -837,10 +837,6 @@ static void config_parse_line(ConfigReader *reader, Config *cfg, char *line, FIL } } break; } - if (streq(setting_any->name, "text-size")) { - config_set_u16(cfg, &setting_text_size_dpi_aware, (u16)roundf((float)integer * ted_get_ui_scaling(ted))); - } - } break; } } @@ -854,6 +850,11 @@ static int key_action_qsort_cmp_combo(const void *av, const void *bv) { return 0; } +void settings_finalize(Ted *ted, Settings *settings) { + arr_qsort(settings->key_actions, key_action_qsort_cmp_combo); + settings->text_size = clamp_u16((u16)roundf((float)settings->text_size_no_dpi * ted_get_ui_scaling(ted)), TEXT_SIZE_MIN, TEXT_SIZE_MAX); +} + static void config_read_file(Ted *ted, const char *cfg_path, const char ***include_stack) { // check for, e.g. %include ted.cfg inside ted.cfg arr_foreach_ptr(*include_stack, const char *, p_include) { diff --git a/ted-internal.h b/ted-internal.h index 0b53e6a..066c38c 100644 --- a/ted-internal.h +++ b/ted-internal.h @@ -484,6 +484,10 @@ void command_execute_ex(Ted *ted, Command c, const CommandArgument *argument, co void config_read(Ted *ted, const char *filename); void config_free_all(Ted *ted); void config_merge_into(Settings *dest, const Config *src_cfg); +/// call this after all your calls to \ref config_merge_into +/// +/// (this sorts key actions, etc.) +void settings_finalize(Ted *ted, Settings *settings); bool config_applies_to(Config *cfg, const char *path, Language language); /// higher-priority configs override lower-priority ones. i32 config_priority(const Config *cfg); @@ -239,6 +239,7 @@ void ted_compute_settings(Ted *ted, const char *path, Language language, Setting config_merge_into(settings, &ted->all_configs[*i]); } arr_free(applicable_configs); + settings_finalize(ted, settings); } Settings *ted_default_settings(Ted *ted) { |