mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
refactor(optionstr.c): break up did_set_string_option 50
This commit is contained in:
@@ -1520,6 +1520,20 @@ static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, char **
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void did_set_lispoptions(char **varp, char **errmsg)
|
||||||
|
{
|
||||||
|
if (**varp != NUL && strcmp(*varp, "expr:0") != 0 && strcmp(*varp, "expr:1") != 0) {
|
||||||
|
*errmsg = e_invarg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void did_set_inccommand(char **errmsg)
|
||||||
|
{
|
||||||
|
if (check_opt_strings(p_icm, p_icm_values, false) != OK) {
|
||||||
|
*errmsg = e_invarg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_checked,
|
static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_checked,
|
||||||
bool *value_changed, char **errmsg)
|
bool *value_changed, char **errmsg)
|
||||||
{
|
{
|
||||||
@@ -1535,6 +1549,20 @@ static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_che
|
|||||||
*value_checked = true;
|
*value_checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void did_set_winhl(win_T *win, char **errmsg)
|
||||||
|
{
|
||||||
|
if (!parse_winhl_opt(win)) {
|
||||||
|
*errmsg = e_invarg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void did_set_termpastefilter(char **errmsg)
|
||||||
|
{
|
||||||
|
if (opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true) != OK) {
|
||||||
|
*errmsg = e_invarg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void did_set_optexpr(buf_T *buf, win_T *win, char **varp, char **gvarp)
|
static void did_set_optexpr(buf_T *buf, win_T *win, char **varp, char **gvarp)
|
||||||
{
|
{
|
||||||
char **p_opt = NULL;
|
char **p_opt = NULL;
|
||||||
@@ -1885,23 +1913,15 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
|
|||||||
// TODO(vim): recognize errors
|
// TODO(vim): recognize errors
|
||||||
parse_cino(curbuf);
|
parse_cino(curbuf);
|
||||||
} else if (gvarp == &p_lop) { // 'lispoptions'
|
} else if (gvarp == &p_lop) { // 'lispoptions'
|
||||||
if (**varp != NUL && strcmp(*varp, "expr:0") != 0 && strcmp(*varp, "expr:1") != 0) {
|
did_set_lispoptions(varp, &errmsg);
|
||||||
errmsg = e_invarg;
|
|
||||||
}
|
|
||||||
} else if (varp == &p_icm) { // 'inccommand'
|
} else if (varp == &p_icm) { // 'inccommand'
|
||||||
if (check_opt_strings(p_icm, p_icm_values, false) != OK) {
|
did_set_inccommand(&errmsg);
|
||||||
errmsg = e_invarg;
|
|
||||||
}
|
|
||||||
} else if (gvarp == &p_ft || gvarp == &p_syn) {
|
} else if (gvarp == &p_ft || gvarp == &p_syn) {
|
||||||
did_set_filetype_or_syntax(varp, oldval, value_checked, &value_changed, &errmsg);
|
did_set_filetype_or_syntax(varp, oldval, value_checked, &value_changed, &errmsg);
|
||||||
} else if (varp == &curwin->w_p_winhl) {
|
} else if (varp == &curwin->w_p_winhl) {
|
||||||
if (!parse_winhl_opt(curwin)) {
|
did_set_winhl(curwin, &errmsg);
|
||||||
errmsg = e_invarg;
|
|
||||||
}
|
|
||||||
} else if (varp == &p_tpf) {
|
} else if (varp == &p_tpf) {
|
||||||
if (opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true) != OK) {
|
did_set_termpastefilter(&errmsg);
|
||||||
errmsg = e_invarg;
|
|
||||||
}
|
|
||||||
} else if (varp == &(curbuf->b_p_vsts)) { // 'varsofttabstop'
|
} else if (varp == &(curbuf->b_p_vsts)) { // 'varsofttabstop'
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user