forked from aniani/vim
patch 9.0.0124: code has more indent than needed
Problem: Code has more indent than needed. Solution: Use continue and return statements. (closes #10824)
This commit is contained in:
parent
c146d974f1
commit
101d57b34b
@ -1241,8 +1241,8 @@ arg_all(void)
|
||||
for (idx = 0; idx < ARGCOUNT; ++idx)
|
||||
{
|
||||
p = alist_name(&ARGLIST[idx]);
|
||||
if (p != NULL)
|
||||
{
|
||||
if (p == NULL)
|
||||
continue;
|
||||
if (len > 0)
|
||||
{
|
||||
// insert a space in between names
|
||||
@ -1268,7 +1268,6 @@ arg_all(void)
|
||||
++len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// second time: break here
|
||||
if (retval != NULL)
|
||||
|
10
src/diff.c
10
src/diff.c
@ -678,9 +678,11 @@ diff_redraw(
|
||||
|
||||
need_diff_redraw = FALSE;
|
||||
FOR_ALL_WINDOWS(wp)
|
||||
// when closing windows or wiping buffers skip invalid window
|
||||
if (wp->w_p_diff && buf_valid(wp->w_buffer))
|
||||
{
|
||||
// when closing windows or wiping buffers skip invalid window
|
||||
if (!wp->w_p_diff || !buf_valid(wp->w_buffer))
|
||||
continue;
|
||||
|
||||
redraw_win_later(wp, SOME_VALID);
|
||||
if (wp != curwin)
|
||||
wp_other = wp;
|
||||
@ -688,8 +690,8 @@ diff_redraw(
|
||||
if (dofold && foldmethodIsDiff(wp))
|
||||
foldUpdateAll(wp);
|
||||
#endif
|
||||
// A change may have made filler lines invalid, need to take care
|
||||
// of that for other windows.
|
||||
// A change may have made filler lines invalid, need to take care of
|
||||
// that for other windows.
|
||||
n = diff_check(wp, wp->w_topline);
|
||||
if ((wp != curwin && wp->w_topfill > 0) || n > 0)
|
||||
{
|
||||
|
@ -3749,7 +3749,8 @@ ins_ctrl_(void)
|
||||
static int
|
||||
ins_start_select(int c)
|
||||
{
|
||||
if (km_startsel)
|
||||
if (!km_startsel)
|
||||
return FALSE;
|
||||
switch (c)
|
||||
{
|
||||
case K_KHOME:
|
||||
@ -3775,8 +3776,8 @@ ins_start_select(int c)
|
||||
case K_S_DOWN:
|
||||
case K_S_END:
|
||||
case K_S_HOME:
|
||||
// Start selection right away, the cursor can move with
|
||||
// CTRL-O when beyond the end of the line.
|
||||
// Start selection right away, the cursor can move with CTRL-O when
|
||||
// beyond the end of the line.
|
||||
start_selection();
|
||||
|
||||
// Execute the key in (insert) Select mode.
|
||||
|
@ -1220,8 +1220,9 @@ do_helptags(char_u *dirname, int add_help_tags, int ignore_writeerr)
|
||||
for (i = 0; i < filecount; ++i)
|
||||
{
|
||||
len = (int)STRLEN(files[i]);
|
||||
if (len > 4)
|
||||
{
|
||||
if (len <= 4)
|
||||
continue;
|
||||
|
||||
if (STRICMP(files[i] + len - 4, ".txt") == 0)
|
||||
{
|
||||
// ".txt" -> language "en"
|
||||
@ -1253,7 +1254,6 @@ do_helptags(char_u *dirname, int add_help_tags, int ignore_writeerr)
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over the found languages to generate a tags file for each one.
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
|
@ -1917,8 +1917,9 @@ check_scrollbind(linenr_T topline_diff, long leftcol_diff)
|
||||
{
|
||||
curbuf = curwin->w_buffer;
|
||||
// skip original window and windows with 'noscrollbind'
|
||||
if (curwin != old_curwin && curwin->w_p_scb)
|
||||
{
|
||||
if (curwin == old_curwin || !curwin->w_p_scb)
|
||||
continue;
|
||||
|
||||
// do the vertical scroll
|
||||
if (want_ver)
|
||||
{
|
||||
@ -1956,7 +1957,6 @@ check_scrollbind(linenr_T topline_diff, long leftcol_diff)
|
||||
leftcol_changed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reset current-window
|
||||
VIsual_select = old_VIsual_select;
|
||||
|
40
src/syntax.c
40
src/syntax.c
@ -1485,9 +1485,10 @@ syn_stack_equal(synstate_T *sp)
|
||||
reg_extmatch_T *six, *bsx;
|
||||
|
||||
// First a quick check if the stacks have the same size end nextlist.
|
||||
if (sp->sst_stacksize == current_state.ga_len
|
||||
&& sp->sst_next_list == current_next_list)
|
||||
{
|
||||
if (sp->sst_stacksize != current_state.ga_len
|
||||
|| sp->sst_next_list != current_next_list)
|
||||
return FALSE;
|
||||
|
||||
// Need to compare all states on both stacks.
|
||||
if (sp->sst_stacksize > SST_FIX_STATES)
|
||||
bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
|
||||
@ -1499,32 +1500,27 @@ syn_stack_equal(synstate_T *sp)
|
||||
// If the item has another index the state is different.
|
||||
if (bp[i].bs_idx != CUR_STATE(i).si_idx)
|
||||
break;
|
||||
if (bp[i].bs_extmatch != CUR_STATE(i).si_extmatch)
|
||||
{
|
||||
// When the extmatch pointers are different, the strings in
|
||||
// them can still be the same. Check if the extmatch
|
||||
// references are equal.
|
||||
if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch)
|
||||
continue;
|
||||
// When the extmatch pointers are different, the strings in them can
|
||||
// still be the same. Check if the extmatch references are equal.
|
||||
bsx = bp[i].bs_extmatch;
|
||||
six = CUR_STATE(i).si_extmatch;
|
||||
// If one of the extmatch pointers is NULL the states are
|
||||
// different.
|
||||
// If one of the extmatch pointers is NULL the states are different.
|
||||
if (bsx == NULL || six == NULL)
|
||||
break;
|
||||
for (j = 0; j < NSUBEXP; ++j)
|
||||
{
|
||||
// Check each referenced match string. They must all be
|
||||
// equal.
|
||||
// Check each referenced match string. They must all be equal.
|
||||
if (bsx->matches[j] != six->matches[j])
|
||||
{
|
||||
// If the pointer is different it can still be the
|
||||
// same text. Compare the strings, ignore case when
|
||||
// the start item has the sp_ic flag set.
|
||||
if (bsx->matches[j] == NULL
|
||||
|| six->matches[j] == NULL)
|
||||
// If the pointer is different it can still be the same text.
|
||||
// Compare the strings, ignore case when the start item has the
|
||||
// sp_ic flag set.
|
||||
if (bsx->matches[j] == NULL || six->matches[j] == NULL)
|
||||
break;
|
||||
if ((SYN_ITEMS(syn_block)[CUR_STATE(i).si_idx]).sp_ic
|
||||
? MB_STRICMP(bsx->matches[j],
|
||||
six->matches[j]) != 0
|
||||
? MB_STRICMP(bsx->matches[j], six->matches[j]) != 0
|
||||
: STRCMP(bsx->matches[j], six->matches[j]) != 0)
|
||||
break;
|
||||
}
|
||||
@ -1532,11 +1528,7 @@ syn_stack_equal(synstate_T *sp)
|
||||
if (j != NSUBEXP)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < 0)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
return i < 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -735,6 +735,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
124,
|
||||
/**/
|
||||
123,
|
||||
/**/
|
||||
|
22
src/window.c
22
src/window.c
@ -2004,11 +2004,10 @@ win_equal_rec(
|
||||
next_curwin_size = -1;
|
||||
FOR_ALL_FRAMES(fr, topfr->fr_child)
|
||||
{
|
||||
// If 'winfixwidth' set keep the window width if
|
||||
// possible.
|
||||
if (!frame_fixed_width(fr))
|
||||
continue;
|
||||
// If 'winfixwidth' set keep the window width if possible.
|
||||
// Watch out for this window being the next_curwin.
|
||||
if (frame_fixed_width(fr))
|
||||
{
|
||||
n = frame_minwidth(fr, NOWIN);
|
||||
new_size = fr->fr_width;
|
||||
if (frame_has_win(fr, next_curwin))
|
||||
@ -2030,7 +2029,6 @@ win_equal_rec(
|
||||
}
|
||||
fr->fr_newwidth = new_size;
|
||||
}
|
||||
}
|
||||
if (next_curwin_size == -1)
|
||||
{
|
||||
if (!has_next_curwin)
|
||||
@ -2145,11 +2143,11 @@ win_equal_rec(
|
||||
next_curwin_size = -1;
|
||||
FOR_ALL_FRAMES(fr, topfr->fr_child)
|
||||
{
|
||||
if (!frame_fixed_height(fr))
|
||||
continue;
|
||||
// If 'winfixheight' set keep the window height if
|
||||
// possible.
|
||||
// Watch out for this window being the next_curwin.
|
||||
if (frame_fixed_height(fr))
|
||||
{
|
||||
n = frame_minheight(fr, NOWIN);
|
||||
new_size = fr->fr_height;
|
||||
if (frame_has_win(fr, next_curwin))
|
||||
@ -2171,7 +2169,6 @@ win_equal_rec(
|
||||
}
|
||||
fr->fr_newheight = new_size;
|
||||
}
|
||||
}
|
||||
if (next_curwin_size == -1)
|
||||
{
|
||||
if (!has_next_curwin)
|
||||
@ -3752,8 +3749,8 @@ close_others(
|
||||
for (wp = firstwin; win_valid(wp); wp = nextwp)
|
||||
{
|
||||
nextwp = wp->w_next;
|
||||
if (wp != curwin) // don't close current window
|
||||
{
|
||||
if (wp == curwin) // don't close current window
|
||||
continue;
|
||||
|
||||
// Check if it's allowed to abandon this window
|
||||
r = can_abandon(wp->w_buffer, forceit);
|
||||
@ -3779,9 +3776,7 @@ close_others(
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
win_close(wp, !buf_hide(wp->w_buffer)
|
||||
&& !bufIsChanged(wp->w_buffer));
|
||||
}
|
||||
win_close(wp, !buf_hide(wp->w_buffer) && !bufIsChanged(wp->w_buffer));
|
||||
}
|
||||
|
||||
if (message && !ONE_WINDOW)
|
||||
@ -5708,6 +5703,7 @@ frame_setheight(frame_T *curfrp, int height)
|
||||
|
||||
if (curfrp->fr_parent == NULL)
|
||||
{
|
||||
// topframe: can only change the command line
|
||||
if (height > ROWS_AVAIL)
|
||||
// If height is greater than the available space, try to create
|
||||
// space for the frame by reducing 'cmdheight' if possible, while
|
||||
|
Loading…
x
Reference in New Issue
Block a user