mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user