mirror of
https://github.com/neovim/neovim.git
synced 2025-12-20 13:25:34 +00:00
refactor(option.c): factor out common skip check
This commit is contained in:
@@ -1410,9 +1410,6 @@ int do_set(char *arg, int opt_flags)
|
|||||||
int value_checked = false;
|
int value_checked = false;
|
||||||
if (flags & P_BOOL) { // boolean
|
if (flags & P_BOOL) { // boolean
|
||||||
do_set_bool(opt_idx, opt_flags, prefix, nextchar, afterchar, varp, &errmsg);
|
do_set_bool(opt_idx, opt_flags, prefix, nextchar, afterchar, varp, &errmsg);
|
||||||
if (errmsg != NULL) {
|
|
||||||
goto skip;
|
|
||||||
}
|
|
||||||
} else { // Numeric or string.
|
} else { // Numeric or string.
|
||||||
if (vim_strchr("=:&<", (uint8_t)nextchar) == NULL
|
if (vim_strchr("=:&<", (uint8_t)nextchar) == NULL
|
||||||
|| prefix != 1) {
|
|| prefix != 1) {
|
||||||
@@ -1423,21 +1420,19 @@ int do_set(char *arg, int opt_flags)
|
|||||||
if (flags & P_NUM) { // numeric
|
if (flags & P_NUM) { // numeric
|
||||||
do_set_num(opt_idx, opt_flags, &arg, nextchar, op, varp, errbuf, sizeof(errbuf),
|
do_set_num(opt_idx, opt_flags, &arg, nextchar, op, varp, errbuf, sizeof(errbuf),
|
||||||
&errmsg);
|
&errmsg);
|
||||||
if (errmsg != NULL) {
|
|
||||||
goto skip;
|
|
||||||
}
|
|
||||||
} else if (opt_idx >= 0) { // String.
|
} else if (opt_idx >= 0) { // String.
|
||||||
do_set_string(opt_idx, opt_flags, &arg, nextchar, op, flags, varp, errbuf,
|
do_set_string(opt_idx, opt_flags, &arg, nextchar, op, flags, varp, errbuf,
|
||||||
sizeof(errbuf), &value_checked, &errmsg);
|
sizeof(errbuf), &value_checked, &errmsg);
|
||||||
if (errmsg != NULL) {
|
|
||||||
goto skip;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// key code option(FIXME(tarruda): Show a warning or something
|
// key code option(FIXME(tarruda): Show a warning or something
|
||||||
// similar)
|
// similar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errmsg != NULL) {
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
if (opt_idx >= 0) {
|
if (opt_idx >= 0) {
|
||||||
did_set_option(opt_idx, opt_flags, op == OP_NONE, value_checked);
|
did_set_option(opt_idx, opt_flags, op == OP_NONE, value_checked);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user