commit 59746d228e5a7dc90e39c3a3bd2917adb21c4f08
parent 5024ac8eb55b7d63df7f70e51efccf2830262a99
Author: Lewis Russell <lewis6991@gmail.com>
Date: Mon, 23 Jan 2023 10:02:17 +0000
refactor(optionstr.c): break up did_set_string_option 30
Diffstat:
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
@@ -1165,8 +1165,8 @@ static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, char **
}
}
-static void did_set_syntax(char **varp, char *oldval, int *value_checked, bool *value_changed,
- char **errmsg)
+static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_checked,
+ bool *value_changed, char **errmsg)
{
if (!valid_filetype(*varp)) {
*errmsg = e_invarg;
@@ -1664,18 +1664,8 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
if (check_opt_strings(p_icm, p_icm_values, false) != OK) {
errmsg = e_invarg;
}
- } else if (gvarp == &p_ft) {
- if (!valid_filetype(*varp)) {
- errmsg = e_invarg;
- } else {
- value_changed = strcmp(oldval, *varp) != 0;
-
- // Since we check the value, there is no need to set P_INSECURE,
- // even when the value comes from a modeline.
- *value_checked = true;
- }
- } else if (gvarp == &p_syn) {
- did_set_syntax(varp, oldval, value_checked, &value_changed, &errmsg);
+ } else if (gvarp == &p_ft || gvarp == &p_syn) {
+ did_set_filetype_or_syntax(varp, oldval, value_checked, &value_changed, &errmsg);
} else if (varp == &curwin->w_p_winhl) {
if (!parse_winhl_opt(curwin)) {
errmsg = e_invarg;