1
0
forked from aniani/vim

patch 9.0.1529: code style test doesn't check for space after "if"

Problem:    Code style test doesn't check for space after "if".
Solution:   Add a test for space.
This commit is contained in:
Bram Moolenaar 2023-05-09 15:00:00 +01:00
parent dda01c05c2
commit c9471b1872
9 changed files with 17 additions and 11 deletions

View File

@ -1854,8 +1854,8 @@ parse_cino(buf_T *buf)
// Handle C++ namespace.
buf->b_ind_cpp_namespace = 0;
// Handle continuation lines containing conditions of if(), for() and
// while().
// Handle continuation lines containing conditions of if (), for () and
// while ().
buf->b_ind_if_for_while = 0;
// indentation for # comments
@ -3317,7 +3317,7 @@ get_c_indent(void)
}
// Special trick: when expecting the while () after a
// do, line up with the while()
// do, line up with the while ()
// do
// x = 1;
// -> here

View File

@ -508,7 +508,7 @@ ex_listdo(exarg_T *eap)
i++;
break;
case CMD_tabdo:
for( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next)
for ( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next)
i++;
break;
case CMD_argdo:

View File

@ -8736,7 +8736,7 @@ test_gui_w32_sendevent_keyboard(dict_T *args)
// If there are modifiers in the args, and it is not a keyup event and
// vkCode is not a modifier key, then we generate virtual modifier key
// messages before sending the actual key message.
if(mods && STRICMP(event, "keydown") == 0 && !isModKey)
if (mods && STRICMP(event, "keydown") == 0 && !isModKey)
{
int n = 0;
if (mods & MOD_MASK_SHIFT)
@ -8769,7 +8769,7 @@ test_gui_w32_sendevent_keyboard(dict_T *args)
if (STRICMP(event, "keyup") == 0)
{
inputs[0].ki.dwFlags = KEYEVENTF_KEYUP;
if(!isModKey)
if (!isModKey)
unwrapMods = TRUE;
}

View File

@ -240,7 +240,7 @@
#define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
#define MB_CHAR2LEN(c) (has_mbyte ? mb_char2len(c) : 1)
#define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p))
#define MB_CHAR2BYTES(c, b) do { if (has_mbyte) (b) += (*mb_char2bytes)((c), (b)); else *(b)++ = (c); } while(0)
#define MB_CHAR2BYTES(c, b) do { if (has_mbyte) (b) += (*mb_char2bytes)((c), (b)); else *(b)++ = (c); } while (0)
#ifdef FEAT_AUTOCHDIR
# define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0)

View File

@ -921,8 +921,8 @@ mch_can_exe(char_u *name, char_u **path UNUSED, int use_path)
struct PathNode *head = DupCmdPathList(NULL);
// For each entry, recur to check for executable.
for(struct PathNode *tail = head; !exe && tail;
tail = (struct PathNode *) BADDR(tail->pn_Next))
for (struct PathNode *tail = head; !exe && tail;
tail = (struct PathNode *) BADDR(tail->pn_Next))
{
SetCurrentDir(tail->pn_Lock);
exe = mch_can_exe(name, path, 0);

View File

@ -6863,7 +6863,7 @@ write_chars(
vim_free(unicodebuf);
unicodebuf = length ? LALLOC_MULT(WCHAR, length) : NULL;
unibuflen = unibuflen ? 0 : length;
} while(1);
} while (TRUE);
cells = mb_string2cells(pchBuf, cbToWrite);
}
else // cbToWrite == 1 && *pchBuf == ' ' && enc_utf8

View File

@ -3822,7 +3822,7 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
} // switch(*p)
} // for(p = postfix; *p; ++p)
} // for (p = postfix; *p; ++p)
if (nfa_calc_size == TRUE)
{

View File

@ -36,6 +36,10 @@ def Test_source_files()
cursor(1, 1)
lnum = search('else\s*{', '', 0, 0, skip)
assert_equal(0, lnum, fname .. ': curly after "else"')
cursor(1, 1)
lnum = search('\<\(if\|while\|for\)(', '', 0, 0, skip)
assert_equal(0, lnum, fname .. ': missing white space after "if"/"while"/"for"')
endfor
bwipe!

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1529,
/**/
1528,
/**/