diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-23 10:02:17 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-01-25 11:48:52 +0000 |
commit | 59746d228e5a7dc90e39c3a3bd2917adb21c4f08 (patch) | |
tree | 322e13a94c82b132ba6d3b76e6f6860b3ab9872b /src/nvim/optionstr.c | |
parent | 5024ac8eb55b7d63df7f70e51efccf2830262a99 (diff) | |
download | rneovim-59746d228e5a7dc90e39c3a3bd2917adb21c4f08.tar.gz rneovim-59746d228e5a7dc90e39c3a3bd2917adb21c4f08.tar.bz2 rneovim-59746d228e5a7dc90e39c3a3bd2917adb21c4f08.zip |
refactor(optionstr.c): break up did_set_string_option 30
Diffstat (limited to 'src/nvim/optionstr.c')
-rw-r--r-- | src/nvim/optionstr.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 48e4f2c6b2..6a1a41e831 100644 --- 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; |