refactor(option): option clearing

This commit is contained in:
Lewis Russell
2023-07-13 16:31:11 +01:00
parent 6a449a892b
commit af3c667ac1
2 changed files with 48 additions and 36 deletions

View File

@@ -429,12 +429,16 @@ void set_string_option_direct_in_buf(buf_T *buf, const char *name, int opt_idx,
/// #OPT_GLOBAL.
///
/// @return NULL on success, an untranslated error message on error.
const char *set_string_option(const int opt_idx, const char *const value, const int opt_flags,
const char *set_string_option(const int opt_idx, const char *value, const int opt_flags,
bool *value_checked, char *const errbuf, const size_t errbuflen)
FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_WARN_UNUSED_RESULT
FUNC_ATTR_WARN_UNUSED_RESULT
{
vimoption_T *opt = get_option(opt_idx);
if (value == NULL) {
value = "";
}
char **varp = (char **)get_varp_scope(opt, ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
? ((opt->indir & PV_BOTH) ? OPT_GLOBAL : OPT_LOCAL)
: opt_flags));