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

@@ -105,7 +105,7 @@ static int coladvance2(win_T *wp, pos_T *pos, bool addspaces, bool finetune, col
|| (State & MODE_TERMINAL)
|| restart_edit != NUL
|| (VIsual_active && *p_sel != 'o')
|| ((get_ve_flags(wp) & VE_ONEMORE) && wcol < MAXCOL);
|| ((get_ve_flags(wp) & kOptVeFlagOnemore) && wcol < MAXCOL);
char *line = ml_get_buf(wp->w_buffer, pos->lnum);
int linelen = ml_get_buf_len(wp->w_buffer, pos->lnum);
@@ -345,7 +345,7 @@ void check_cursor_col(win_T *win)
// - 'virtualedit' is set
if ((State & MODE_INSERT) || restart_edit
|| (VIsual_active && *p_sel != 'o')
|| (cur_ve_flags & VE_ONEMORE)
|| (cur_ve_flags & kOptVeFlagOnemore)
|| virtual_active(win)) {
win->w_cursor.col = len;
} else {
@@ -362,7 +362,7 @@ void check_cursor_col(win_T *win)
// line.
if (oldcol == MAXCOL) {
win->w_cursor.coladd = 0;
} else if (cur_ve_flags == VE_ALL) {
} else if (cur_ve_flags == kOptVeFlagAll) {
if (oldcoladd > win->w_cursor.col) {
win->w_cursor.coladd = oldcoladd - win->w_cursor.col;