aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/grid.c
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-11-23 14:22:06 +0600
committerGitHub <noreply@github.com>2024-11-23 08:22:06 +0000
commit8516c2dc1f301c439695629fff771227dbe00d30 (patch)
tree5e052ad234f99cdbfce89b03ba71796a8cd274ef /src/nvim/grid.c
parent9a681ad09e2add96d47bf3f39cca8029f3bf09df (diff)
downloadrneovim-8516c2dc1f301c439695629fff771227dbe00d30.tar.gz
rneovim-8516c2dc1f301c439695629fff771227dbe00d30.tar.bz2
rneovim-8516c2dc1f301c439695629fff771227dbe00d30.zip
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>
Diffstat (limited to 'src/nvim/grid.c')
-rw-r--r--src/nvim/grid.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/grid.c b/src/nvim/grid.c
index acb336c725..e863cb3476 100644
--- a/src/nvim/grid.c
+++ b/src/nvim/grid.c
@@ -383,7 +383,7 @@ void grid_line_start(ScreenGrid *grid, int row)
assert((size_t)grid_line_maxcol <= linebuf_size);
- if (rdb_flags & RDB_INVALID) {
+ if (rdb_flags & kOptRdbFlagInvalid) {
// Current batch must not depend on previous contents of linebuf_char.
// Set invalid values which will cause assertion failures later if they are used.
memset(linebuf_char, 0xFF, sizeof(schar_T) * linebuf_size);
@@ -602,7 +602,7 @@ void grid_line_flush(void)
void grid_line_flush_if_valid_row(void)
{
if (grid_line_row < 0 || grid_line_row >= grid_line_grid->rows) {
- if (rdb_flags & RDB_INVALID) {
+ if (rdb_flags & kOptRdbFlagInvalid) {
abort();
} else {
grid_line_grid = NULL;
@@ -639,7 +639,7 @@ static int grid_char_needs_redraw(ScreenGrid *grid, int col, size_t off_to, int
|| (cols > 1 && linebuf_char[col + 1] == 0
&& linebuf_char[col + 1] != grid->chars[off_to + 1]))
|| exmode_active // TODO(bfredl): what in the actual fuck
- || rdb_flags & RDB_NODELTA));
+ || rdb_flags & kOptRdbFlagNodelta));
}
/// Move one buffered line to the window grid, but only the characters that
@@ -784,7 +784,7 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int col, int endcol
size_t off = off_to + (size_t)col;
if (grid->chars[off] != schar_from_ascii(' ')
|| grid->attrs[off] != bg_attr
- || rdb_flags & RDB_NODELTA) {
+ || rdb_flags & kOptRdbFlagNodelta) {
grid->chars[off] = schar_from_ascii(' ');
grid->attrs[off] = bg_attr;
if (clear_dirty_start == -1) {