mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 17:58:18 +00:00
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:
@@ -1015,7 +1015,8 @@ retry:
|
||||
}
|
||||
read_buf_col += n;
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
|
||||
// Append whole line and new-line. Change NL
|
||||
// to NUL to reverse the effect done below.
|
||||
for (ni = 0; ni < n; ni++) {
|
||||
@@ -1031,14 +1032,13 @@ retry:
|
||||
// When the last line didn't have an
|
||||
// end-of-line don't add it now either.
|
||||
if (!curbuf->b_p_eol) {
|
||||
--tlen;
|
||||
tlen--;
|
||||
}
|
||||
size = tlen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Read bytes from the file.
|
||||
|
@@ -2327,16 +2327,16 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, b
|
||||
* We are finished, break the loop here.
|
||||
*/
|
||||
break;
|
||||
} else { // pointer block full
|
||||
/*
|
||||
* split the pointer block
|
||||
* allocate a new pointer block
|
||||
* move some of the pointer into the new block
|
||||
* prepare for updating the parent block
|
||||
*/
|
||||
}
|
||||
// pointer block full
|
||||
//
|
||||
// split the pointer block
|
||||
// allocate a new pointer block
|
||||
// move some of the pointer into the new block
|
||||
// prepare for updating the parent block
|
||||
for (;;) { // do this twice when splitting block 1
|
||||
hp_new = ml_new_ptr(mfp);
|
||||
if (hp_new == NULL) { // TODO: try to fix tree
|
||||
if (hp_new == NULL) { // TODO(vim): try to fix tree
|
||||
return FAIL;
|
||||
}
|
||||
pp_new = hp_new->bh_data;
|
||||
@@ -2345,12 +2345,10 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, b
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* if block 1 becomes full the tree is given an extra level
|
||||
* The pointers from block 1 are moved into the new block.
|
||||
* block 1 is updated to point to the new block
|
||||
* then continue to split the new block
|
||||
*/
|
||||
// if block 1 becomes full the tree is given an extra level
|
||||
// The pointers from block 1 are moved into the new block.
|
||||
// block 1 is updated to point to the new block
|
||||
// then continue to split the new block
|
||||
memmove(pp_new, pp, (size_t)page_size);
|
||||
pp->pb_count = 1;
|
||||
pp->pb_pointer[0].pe_bnum = hp_new->bh_bnum;
|
||||
@@ -2362,12 +2360,10 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, b
|
||||
pp = pp_new;
|
||||
CHECK(stack_idx != 0, _("stack_idx should be 0"));
|
||||
ip->ip_index = 0;
|
||||
++stack_idx; // do block 1 again later
|
||||
stack_idx++; // do block 1 again later
|
||||
}
|
||||
/*
|
||||
* move the pointers after the current one to the new block
|
||||
* If there are none, the new entry will be in the new block.
|
||||
*/
|
||||
// move the pointers after the current one to the new block
|
||||
// If there are none, the new entry will be in the new block.
|
||||
total_moved = pp->pb_count - pb_idx - 1;
|
||||
if (total_moved) {
|
||||
memmove(&pp_new->pb_pointer[0],
|
||||
@@ -2397,15 +2393,13 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, b
|
||||
lnum_left = 0;
|
||||
lnum_right = 0;
|
||||
|
||||
/*
|
||||
* recompute line counts
|
||||
*/
|
||||
// recompute line counts
|
||||
line_count_right = 0;
|
||||
for (i = 0; i < (int)pp_new->pb_count; ++i) {
|
||||
for (i = 0; i < (int)pp_new->pb_count; i++) {
|
||||
line_count_right += pp_new->pb_pointer[i].pe_line_count;
|
||||
}
|
||||
line_count_left = 0;
|
||||
for (i = 0; i < (int)pp->pb_count; ++i) {
|
||||
for (i = 0; i < (int)pp->pb_count; i++) {
|
||||
line_count_left += pp->pb_pointer[i].pe_line_count;
|
||||
}
|
||||
|
||||
@@ -2416,7 +2410,6 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, b
|
||||
mf_put(mfp, hp, true, false);
|
||||
mf_put(mfp, hp_new, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Safety check: fallen out of for loop?
|
||||
|
@@ -5140,7 +5140,8 @@ 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) {
|
||||
@@ -5178,7 +5179,6 @@ char *set_option_value(const char *const name, const long number, const char *co
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -2289,7 +2289,8 @@ static void check_state_ends(void)
|
||||
next_match_idx = 0;
|
||||
next_match_col = MAXCOL;
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
|
||||
// handle next_list, unless at end of line and no "skipnl" or
|
||||
// "skipempty"
|
||||
current_next_list = cur_si->si_next_list;
|
||||
@@ -2318,18 +2319,15 @@ static void check_state_ends(void)
|
||||
|
||||
cur_si = &CUR_STATE(current_state.ga_len - 1);
|
||||
|
||||
/*
|
||||
* Only for a region the search for the end continues after
|
||||
* the end of the contained item. If the contained match
|
||||
* included the end-of-line, break here, the region continues.
|
||||
* Don't do this when:
|
||||
* - "keepend" is used for the contained item
|
||||
* - not at the end of the line (could be end="x$"me=e-1).
|
||||
* - "excludenl" is used (HL_HAS_EOL won't be set)
|
||||
*/
|
||||
// Only for a region the search for the end continues after
|
||||
// the end of the contained item. If the contained match
|
||||
// included the end-of-line, break here, the region continues.
|
||||
// Don't do this when:
|
||||
// - "keepend" is used for the contained item
|
||||
// - not at the end of the line (could be end="x$"me=e-1).
|
||||
// - "excludenl" is used (HL_HAS_EOL won't be set)
|
||||
if (cur_si->si_idx >= 0
|
||||
&& SYN_ITEMS(syn_block)[cur_si->si_idx].sp_type
|
||||
== SPTYPE_START
|
||||
&& SYN_ITEMS(syn_block)[cur_si->si_idx].sp_type == SPTYPE_START
|
||||
&& !(cur_si->si_flags & (HL_MATCH | HL_KEEPEND))) {
|
||||
update_si_end(cur_si, (int)current_col, true);
|
||||
check_keepend();
|
||||
@@ -2339,7 +2337,6 @@ static void check_state_ends(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user