vim-patch:8.2.4704: using "else" after return or break increases indent (#18032)

Problem:    Using "else" after return or break increases indent.
Solution:   Remove "else" and reduce indent. (Goc Dundar, closes vim/vim#10099)
f26c16144d
This commit is contained in:
zeertzjq
2022-04-08 10:25:22 +08:00
committed by GitHub
parent 4c9a71c69e
commit 356baae80a
4 changed files with 170 additions and 180 deletions

View File

@@ -5140,43 +5140,43 @@ char *set_option_value(const char *const name, const long number, const char *co
s = "";
}
return set_string_option(opt_idx, s, opt_flags);
} else {
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
if (varp != NULL) { // hidden option is not changed
if (number == 0 && string != NULL) {
int idx;
}
// Either we are given a string or we are setting option
// to zero.
for (idx = 0; string[idx] == '0'; idx++) {}
if (string[idx] != NUL || idx == 0) {
// There's another character after zeros or the string
// is empty. In both cases, we are trying to set a
// num option using a string.
semsg(_("E521: Number required: &%s = '%s'"),
name, string);
return NULL; // do nothing as we hit an error
}
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
if (varp != NULL) { // hidden option is not changed
if (number == 0 && string != NULL) {
int idx;
// Either we are given a string or we are setting option
// to zero.
for (idx = 0; string[idx] == '0'; idx++) {}
if (string[idx] != NUL || idx == 0) {
// There's another character after zeros or the string
// is empty. In both cases, we are trying to set a
// num option using a string.
semsg(_("E521: Number required: &%s = '%s'"),
name, string);
return NULL; // do nothing as we hit an error
}
long numval = number;
if (opt_flags & OPT_CLEAR) {
if ((int *)varp == &curbuf->b_p_ar) {
numval = -1;
} else if ((long *)varp == &curbuf->b_p_ul) {
numval = NO_LOCAL_UNDOLEVEL;
} else if ((long *)varp == &curwin->w_p_so || (long *)varp == &curwin->w_p_siso) {
numval = -1;
} else {
char *s = NULL;
(void)get_option_value(name, &numval, (char_u **)&s, OPT_GLOBAL);
}
}
if (flags & P_NUM) {
return set_num_option(opt_idx, varp, numval, NULL, 0, opt_flags);
}
long numval = number;
if (opt_flags & OPT_CLEAR) {
if ((int *)varp == &curbuf->b_p_ar) {
numval = -1;
} else if ((long *)varp == &curbuf->b_p_ul) {
numval = NO_LOCAL_UNDOLEVEL;
} else if ((long *)varp == &curwin->w_p_so || (long *)varp == &curwin->w_p_siso) {
numval = -1;
} else {
return set_bool_option(opt_idx, varp, (int)numval, opt_flags);
char *s = NULL;
(void)get_option_value(name, &numval, (char_u **)&s, OPT_GLOBAL);
}
}
if (flags & P_NUM) {
return set_num_option(opt_idx, varp, numval, NULL, 0, opt_flags);
} else {
return set_bool_option(opt_idx, varp, (int)numval, opt_flags);
}
}
}
return NULL;