commit 5adf8f92762bc457e4314b5d94d5485b51eef713
parent db6461b6ad20b3fb25f7cdec85b4fe91afd30b40
Author: Lewis Russell <lewis6991@gmail.com>
Date: Thu, 19 Jan 2023 10:29:27 +0000
refactor(optionstr.c): break up did_set_string_option 16
Diffstat:
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
@@ -1055,6 +1055,15 @@ static void did_set_complete(char **varp, char *errbuf, size_t errbuflen, char *
}
}
+static void did_set_completeopt(char **errmsg)
+{
+ if (check_opt_strings(p_cot, p_cot_values, true) != OK) {
+ *errmsg = e_invarg;
+ } else {
+ completeopt_was_set();
+ }
+}
+
/// Handle string options that need some action to perform when changed.
/// The new value must be allocated.
///
@@ -1328,11 +1337,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
} else if (gvarp == &p_cpt) { // 'complete'
did_set_complete(varp, errbuf, errbuflen, &errmsg);
} else if (varp == &p_cot) { // 'completeopt'
- if (check_opt_strings(p_cot, p_cot_values, true) != OK) {
- errmsg = e_invarg;
- } else {
- completeopt_was_set();
- }
+ did_set_completeopt(&errmsg);
#ifdef BACKSLASH_IN_FILENAME
} else if (gvarp == &p_csl) { // 'completeslash'
if (check_opt_strings(p_csl, p_csl_values, false) != OK