aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/optionstr.c
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-10-28 19:49:16 +0600
committerGitHub <noreply@github.com>2024-10-28 06:49:16 -0700
commit34c44c355646311aa67fe53e1e5ce040789430c6 (patch)
tree6de3c32213b1313d41035c17b024fcade9afc6ef /src/nvim/optionstr.c
parent0b7cc014fc0ed8d0765e8504ff4a8ff7a84dac42 (diff)
downloadrneovim-34c44c355646311aa67fe53e1e5ce040789430c6.tar.gz
rneovim-34c44c355646311aa67fe53e1e5ce040789430c6.tar.bz2
rneovim-34c44c355646311aa67fe53e1e5ce040789430c6.zip
refactor(options): option flags enum #30961
Problem: Currently we use macros with hardcoded flag values for option flags, which is messy and requires a lot of mental math for adding / removing option flags. Using macros for option flags also means that they cannot be used inside debuggers. Solution: Create a new `OptFlags` enum that stores all the option flags in an organized way that is easier to understand.
Diffstat (limited to 'src/nvim/optionstr.c')
-rw-r--r--src/nvim/optionstr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 651a9d20bf..e07fcf2f0e 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -419,9 +419,9 @@ const char *check_stl_option(char *s)
/// often illegal in a file name. Be more permissive if "secure" is off.
bool check_illegal_path_names(char *val, uint32_t flags)
{
- return (((flags & P_NFNAME)
+ return (((flags & kOptFlagNFname)
&& strpbrk(val, (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
- || ((flags & P_NDNAME)
+ || ((flags & kOptFlagNDname)
&& strpbrk(val, "*?[|;&<>\r\n") != NULL));
}
@@ -1377,7 +1377,7 @@ const char *did_set_filetype_or_syntax(optset_T *args)
args->os_value_changed = strcmp(args->os_oldval.string.data, *varp) != 0;
- // Since we check the value, there is no need to set P_INSECURE,
+ // Since we check the value, there is no need to set kOptFlagInsecure,
// even when the value comes from a modeline.
args->os_value_checked = true;
@@ -1658,7 +1658,7 @@ const char *did_set_keymap(optset_T *args)
secure = secure_save;
- // Since we check the value, there is no need to set P_INSECURE,
+ // Since we check the value, there is no need to set kOptFlagInsecure,
// even when the value comes from a modeline.
args->os_value_checked = true;