refactor(options): autogenerate valid values and flag enums for options (#31089)

Problem: Option metadata like list of valid values for an option and
option flags are not listed in the `options.lua` file and are instead
manually defined in C, which means option metadata is split between
several places.

Solution: Put metadata such as list of valid values for an option and
option flags in `options.lua`, and autogenerate the corresponding C
variables and enums.

Supersedes #28659

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
Famiu Haque
2024-11-23 14:22:06 +06:00
committed by GitHub
parent 9a681ad09e
commit 8516c2dc1f
43 changed files with 774 additions and 665 deletions

View File

@@ -793,7 +793,7 @@ bool briopt_check(char *briopt, win_T *wp)
}
while (*p != NUL) {
// Note: Keep this in sync with p_briopt_values
// Note: Keep this in sync with opt_briopt_values.
if (strncmp(p, "shift:", 6) == 0
&& ((p[6] == '-' && ascii_isdigit(p[7])) || ascii_isdigit(p[6]))) {
p += 6;
@@ -872,7 +872,7 @@ int get_breakindent_win(win_T *wp, char *line)
|| prev_tick != buf_get_changedtick(wp->w_buffer)
|| prev_listopt != wp->w_briopt_list
|| prev_no_ts != no_ts
|| prev_dy_uhex != (dy_flags & DY_UHEX)
|| prev_dy_uhex != (dy_flags & kOptDyFlagUhex)
|| prev_flp == NULL
|| strcmp(prev_flp, get_flp_value(wp->w_buffer)) != 0
|| prev_line == NULL || strcmp(prev_line, line) != 0) {
@@ -893,7 +893,7 @@ int get_breakindent_win(win_T *wp, char *line)
prev_listopt = wp->w_briopt_list;
prev_list = 0;
prev_no_ts = no_ts;
prev_dy_uhex = (dy_flags & DY_UHEX);
prev_dy_uhex = (dy_flags & kOptDyFlagUhex);
xfree(prev_flp);
prev_flp = xstrdup(get_flp_value(wp->w_buffer));
// add additional indent for numbered lists