0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1208: code is indented more than necessary

Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes #11819)
This commit is contained in:
Yegappan Lakshmanan
2023-01-16 18:19:05 +00:00
committed by Bram Moolenaar
parent 450c7a97d1
commit a41e221935
12 changed files with 1318 additions and 1312 deletions

View File

@@ -989,11 +989,11 @@ mb_adjust_opend(oparg_T *oap)
{
char_u *p;
if (oap->inclusive)
{
p = ml_get(oap->end.lnum);
oap->end.col += mb_tail_off(p, p + oap->end.col);
}
if (!oap->inclusive)
return;
p = ml_get(oap->end.lnum);
oap->end.col += mb_tail_off(p, p + oap->end.col);
}
/*
@@ -1869,22 +1869,23 @@ adjust_cursor_eol(void)
{
unsigned int cur_ve_flags = get_ve_flags();
if (curwin->w_cursor.col > 0
&& gchar_cursor() == NUL
&& (cur_ve_flags & VE_ONEMORE) == 0
&& !(restart_edit || (State & MODE_INSERT)))
int adj_cursor = (curwin->w_cursor.col > 0
&& gchar_cursor() == NUL
&& (cur_ve_flags & VE_ONEMORE) == 0
&& !(restart_edit || (State & MODE_INSERT)));
if (!adj_cursor)
return;
// Put the cursor on the last character in the line.
dec_cursor();
if (cur_ve_flags == VE_ALL)
{
// Put the cursor on the last character in the line.
dec_cursor();
colnr_T scol, ecol;
if (cur_ve_flags == VE_ALL)
{
colnr_T scol, ecol;
// Coladd is set to the width of the last character.
getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol);
curwin->w_cursor.coladd = ecol - scol + 1;
}
// Coladd is set to the width of the last character.
getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol);
curwin->w_cursor.coladd = ecol - scol + 1;
}
}
@@ -2235,12 +2236,12 @@ reset_lbr(void)
static void
restore_lbr(int lbr_saved)
{
if (!curwin->w_p_lbr && lbr_saved)
{
// changing 'linebreak' may require w_virtcol to be updated
curwin->w_p_lbr = TRUE;
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
}
if (curwin->w_p_lbr || !lbr_saved)
return;
// changing 'linebreak' may require w_virtcol to be updated
curwin->w_p_lbr = TRUE;
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
}
#endif