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

@@ -425,7 +425,7 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, LineFlag
for (int i = skipstart; i < (endcol - skipend) - startcol; i++) {
if (attrbuf[i] < 0) {
if (rdb_flags & RDB_INVALID) {
if (rdb_flags & kOptRdbFlagInvalid) {
abort();
} else {
attrbuf[i] = 0;
@@ -441,7 +441,7 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, LineFlag
static void compose_debug(Integer startrow, Integer endrow, Integer startcol, Integer endcol,
int syn_id, bool delay)
{
if (!(rdb_flags & RDB_COMPOSITOR) || startcol >= endcol) {
if (!(rdb_flags & kOptRdbFlagCompositor) || startcol >= endcol) {
return;
}
@@ -637,7 +637,7 @@ void ui_comp_grid_scroll(Integer grid, Integer top, Integer bot, Integer left, I
}
} else {
ui_composed_call_grid_scroll(1, top, bot, left, right, rows, cols);
if (rdb_flags & RDB_COMPOSITOR) {
if (rdb_flags & kOptRdbFlagCompositor) {
debug_delay(2);
}
}