diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-11-23 14:22:06 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-23 08:22:06 +0000 |
commit | 8516c2dc1f301c439695629fff771227dbe00d30 (patch) | |
tree | 5e052ad234f99cdbfce89b03ba71796a8cd274ef /src/nvim/terminal.c | |
parent | 9a681ad09e2add96d47bf3f39cca8029f3bf09df (diff) | |
download | rneovim-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/terminal.c')
-rw-r--r-- | src/nvim/terminal.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 5ff7f721ba..b4496d6758 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -598,12 +598,12 @@ bool terminal_enter(void) int save_w_p_cuc = curwin->w_p_cuc; OptInt save_w_p_so = curwin->w_p_so; OptInt save_w_p_siso = curwin->w_p_siso; - if (curwin->w_p_cul && curwin->w_p_culopt_flags & CULOPT_NBR) { + if (curwin->w_p_cul && curwin->w_p_culopt_flags & kOptCuloptFlagNumber) { if (strcmp(curwin->w_p_culopt, "number") != 0) { save_w_p_culopt = curwin->w_p_culopt; curwin->w_p_culopt = xstrdup("number"); } - curwin->w_p_culopt_flags = CULOPT_NBR; + curwin->w_p_culopt_flags = kOptCuloptFlagNumber; } else { curwin->w_p_cul = false; } @@ -868,28 +868,28 @@ static bool is_filter_char(int c) unsigned flag = 0; switch (c) { case 0x08: - flag = TPF_BS; + flag = kOptTpfFlagBS; break; case 0x09: - flag = TPF_HT; + flag = kOptTpfFlagHT; break; case 0x0A: case 0x0D: break; case 0x0C: - flag = TPF_FF; + flag = kOptTpfFlagFF; break; case 0x1b: - flag = TPF_ESC; + flag = kOptTpfFlagESC; break; case 0x7F: - flag = TPF_DEL; + flag = kOptTpfFlagDEL; break; default: if (c < ' ') { - flag = TPF_C0; + flag = kOptTpfFlagC0; } else if (c >= 0x80 && c <= 0x9F) { - flag = TPF_C1; + flag = kOptTpfFlagC1; } } return !!(tpf_flags & flag); @@ -1181,7 +1181,7 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *data) /// Called when the terminal wants to ring the system bell. static int term_bell(void *data) { - vim_beep(BO_TERM); + vim_beep(kOptBoFlagTerm); return 1; } |