To: vim_dev@googlegroups.com Subject: Patch 9.0.1529 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1529 Problem: Code style test doesn't check for space after "if". Solution: Add a test for space. Files: src/testdir/test_codestyle.vim, src/cindent.c, src/gui_w32.c, src/ex_cmds2.c, src/os_amiga.c, src/os_win32.c, src/regexp_nfa.c, src/macros.h *** ../vim-9.0.1528/src/testdir/test_codestyle.vim 2023-02-21 13:33:14.240461686 +0000 --- src/testdir/test_codestyle.vim 2023-05-09 14:53:56.428277402 +0100 *************** *** 36,41 **** --- 36,45 ---- 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! *** ../vim-9.0.1528/src/cindent.c 2023-03-24 19:25:02.156080183 +0000 --- src/cindent.c 2023-05-09 14:54:51.020249647 +0100 *************** *** 1854,1861 **** // Handle C++ namespace. buf->b_ind_cpp_namespace = 0; ! // Handle continuation lines containing conditions of if(), for() and ! // while(). buf->b_ind_if_for_while = 0; // indentation for # comments --- 1854,1861 ---- // Handle C++ namespace. buf->b_ind_cpp_namespace = 0; ! // Handle continuation lines containing conditions of if (), for () and ! // while (). buf->b_ind_if_for_while = 0; // indentation for # comments *************** *** 3317,3323 **** } // Special trick: when expecting the while () after a ! // do, line up with the while() // do // x = 1; // -> here --- 3317,3323 ---- } // Special trick: when expecting the while () after a ! // do, line up with the while () // do // x = 1; // -> here *** ../vim-9.0.1528/src/gui_w32.c 2023-03-07 17:45:07.184247900 +0000 --- src/gui_w32.c 2023-05-09 14:50:39.492373891 +0100 *************** *** 8736,8742 **** // 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) { int n = 0; if (mods & MOD_MASK_SHIFT) --- 8736,8742 ---- // 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) { int n = 0; if (mods & MOD_MASK_SHIFT) *************** *** 8769,8775 **** if (STRICMP(event, "keyup") == 0) { inputs[0].ki.dwFlags = KEYEVENTF_KEYUP; ! if(!isModKey) unwrapMods = TRUE; } --- 8769,8775 ---- if (STRICMP(event, "keyup") == 0) { inputs[0].ki.dwFlags = KEYEVENTF_KEYUP; ! if (!isModKey) unwrapMods = TRUE; } *** ../vim-9.0.1528/src/ex_cmds2.c 2023-01-09 19:04:19.304528371 +0000 --- src/ex_cmds2.c 2023-05-09 14:55:33.676227712 +0100 *************** *** 508,514 **** i++; break; case CMD_tabdo: ! for( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next) i++; break; case CMD_argdo: --- 508,514 ---- i++; break; case CMD_tabdo: ! for ( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next) i++; break; case CMD_argdo: *** ../vim-9.0.1528/src/os_amiga.c 2023-03-07 15:30:46.129459752 +0000 --- src/os_amiga.c 2023-05-09 14:56:12.388207617 +0100 *************** *** 921,928 **** 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)) { SetCurrentDir(tail->pn_Lock); exe = mch_can_exe(name, path, 0); --- 921,928 ---- 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)) { SetCurrentDir(tail->pn_Lock); exe = mch_can_exe(name, path, 0); *** ../vim-9.0.1528/src/os_win32.c 2023-03-07 17:45:07.188247898 +0000 --- src/os_win32.c 2023-05-09 14:56:52.104186860 +0100 *************** *** 6863,6869 **** vim_free(unicodebuf); unicodebuf = length ? LALLOC_MULT(WCHAR, length) : NULL; unibuflen = unibuflen ? 0 : length; ! } while(1); cells = mb_string2cells(pchBuf, cbToWrite); } else // cbToWrite == 1 && *pchBuf == ' ' && enc_utf8 --- 6863,6869 ---- vim_free(unicodebuf); unicodebuf = length ? LALLOC_MULT(WCHAR, length) : NULL; unibuflen = unibuflen ? 0 : length; ! } while (TRUE); cells = mb_string2cells(pchBuf, cbToWrite); } else // cbToWrite == 1 && *pchBuf == ' ' && enc_utf8 *** ../vim-9.0.1528/src/regexp_nfa.c 2023-03-25 11:31:29.115831726 +0000 --- src/regexp_nfa.c 2023-05-09 14:57:11.768176531 +0100 *************** *** 3822,3828 **** } // switch(*p) ! } // for(p = postfix; *p; ++p) if (nfa_calc_size == TRUE) { --- 3822,3828 ---- } // switch(*p) ! } // for (p = postfix; *p; ++p) if (nfa_calc_size == TRUE) { *** ../vim-9.0.1528/src/macros.h 2023-04-15 13:17:22.879094522 +0100 --- src/macros.h 2023-05-09 14:57:57.012152620 +0100 *************** *** 240,246 **** #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) #ifdef FEAT_AUTOCHDIR # define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0) --- 240,246 ---- #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) #ifdef FEAT_AUTOCHDIR # define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0) *** ../vim-9.0.1528/src/version.c 2023-05-08 22:11:03.440937436 +0100 --- src/version.c 2023-05-09 14:55:52.676217875 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1529, /**/ -- hundred-and-one symptoms of being an internet addict: 27. You refer to your age as 3.x. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///