aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option_defs.h
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2025-01-16 20:53:17 +0000
committerGitHub <noreply@github.com>2025-01-16 20:53:17 +0000
commitfb564ddff0b4ec9dad5afa7548777af1c3044273 (patch)
treebece6f53cd54b2b5c85228d689ac88e227b9e250 /src/nvim/option_defs.h
parent92d3bf101d07d52cfbd4c22e6e06251897adda34 (diff)
downloadrneovim-fb564ddff0b4ec9dad5afa7548777af1c3044273.tar.gz
rneovim-fb564ddff0b4ec9dad5afa7548777af1c3044273.tar.bz2
rneovim-fb564ddff0b4ec9dad5afa7548777af1c3044273.zip
refactor(options): generic expand and did_set callbacks (#32011)
* refactor(options): generic expand and did_set callbacks Problem: Many options have similar callbacks to check the values are valid. Solution: Generalize these callbacks into a single function that reads the option table. * refactor: gen_options.lua refactor: gen_options.lua - inline get_cond * refactor(options): use a simpler format for the common default
Diffstat (limited to 'src/nvim/option_defs.h')
-rw-r--r--src/nvim/option_defs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 2b51547004..7dd4bd2bc7 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -134,6 +134,7 @@ typedef const char *(*opt_did_set_cb_T)(optset_T *args);
typedef struct {
/// Pointer to the option variable. It's always a string.
char *oe_varp;
+ OptIndex oe_idx;
/// The original option value, escaped.
char *oe_opt_value;
@@ -174,9 +175,13 @@ typedef struct {
void *var; ///< global option: pointer to variable;
///< window-local option: NULL;
///< buffer-local option: global value
+ unsigned *flags_var;
ssize_t scope_idx[kOptScopeSize]; ///< index of option at every scope.
bool immutable; ///< option is immutable, trying to set it will give an error.
+ const char **values; ///< possible values for string options
+ const size_t values_len; ///< length of values array
+
/// callback function to invoke after an option is modified to validate and
/// apply the new value.
opt_did_set_cb_T opt_did_set_cb;