diff options
author | pommicket <pommicket@gmail.com> | 2023-10-18 12:58:59 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-10-18 12:58:59 -0400 |
commit | 4d57539ffc2954e5c3b9c42da41511f69c4fcde9 (patch) | |
tree | db691445e296448deb2aa55cef6acb04a256b2ee /ted-internal.h | |
parent | 29282f362d5f663ec3da17b135751f3b9b2bd0fd (diff) |
start editorconfig support
Diffstat (limited to 'ted-internal.h')
-rw-r--r-- | ted-internal.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ted-internal.h b/ted-internal.h index af5f2dd..f6649a2 100644 --- a/ted-internal.h +++ b/ted-internal.h @@ -153,11 +153,29 @@ struct Settings { KeyAction *key_actions; }; +typedef enum { + CONFIG_TED_CFG = 1, + CONFIG_EDITORCONFIG = 2, +} ConfigFormat; + typedef struct { + /// path to config file + RcStr *source; + /// format of config file + ConfigFormat format; + /// is this from a root .editorconfig file? + /// + /// (if so, we don't want to apply editorconfigs in higher-up directories) + bool is_editorconfig_root; + /// language this config applies to Language language; + /// path regex this config applies to struct pcre2_real_code_8 *path; + /// path regex string char *path_regex; + /// settings which this config specifies Settings settings; + /// which bytes of settings are actually set bool settings_set[sizeof (Settings)]; } Config; @@ -479,7 +497,12 @@ void command_init(void); void command_execute_ex(Ted *ted, Command c, const CommandArgument *argument, const CommandContext *context); // === config.c === -void config_read(Ted *ted, const char *filename); +/// read a config file. +/// +/// returns true on success. if the file at `path` does not exist, this returns false but doesn't show an error message. +/// +/// if the config with this path has already been read, this does nothing. +bool config_read(Ted *ted, const char *path, ConfigFormat format); 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 |