Merge pull request #16748 from zeertzjq/vim-8.1.1434

vim-patch:8.1.{1434,1585},8.2.{3482,3625,3876}: some cindent patches
This commit is contained in:
zeertzjq 2022-01-31 04:49:54 +08:00 committed by GitHub
commit a28a9aec63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5201 additions and 6 deletions

View File

@ -152,11 +152,11 @@ static char_u *skip_string(char_u *p)
*/ */
for (;; p++) { for (;; p++) {
if (p[0] == '\'') { // 'c' or '\n' or '\000' if (p[0] == '\'') { // 'c' or '\n' or '\000'
if (!p[1]) { // ' at end of line if (p[1] == NUL) { // ' at end of line
break; break;
} }
i = 2; i = 2;
if (p[1] == '\\') { // '\n' or '\000' if (p[1] == '\\' && p[2] != NUL) { // '\n' or '\000'
i++; i++;
while (ascii_isdigit(p[i - 1])) { // '\000' while (ascii_isdigit(p[i - 1])) { // '\000'
i++; i++;
@ -541,6 +541,11 @@ static bool cin_is_cpp_namespace(char_u *s)
bool has_name_start = false; bool has_name_start = false;
s = cin_skipcomment(s); s = cin_skipcomment(s);
if (STRNCMP(s, "inline", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6]))) {
s = cin_skipcomment(skipwhite(s + 6));
}
if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) { if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) {
p = cin_skipcomment(skipwhite(s + 9)); p = cin_skipcomment(skipwhite(s + 9));
while (*p != NUL) { while (*p != NUL) {
@ -1411,8 +1416,8 @@ static int cin_skip2pos(pos_T *trypos)
static pos_T *find_start_brace(void) // XXX static pos_T *find_start_brace(void) // XXX
{ {
pos_T cursor_save; pos_T cursor_save;
pos_T *trypos; pos_T *trypos;
pos_T *pos; pos_T *pos;
static pos_T pos_copy; static pos_T pos_copy;
cursor_save = curwin->w_cursor; cursor_save = curwin->w_cursor;
@ -1427,7 +1432,7 @@ static pos_T *find_start_brace(void) // XXX
break; break;
} }
if (pos != NULL) { if (pos != NULL) {
curwin->w_cursor.lnum = pos->lnum; curwin->w_cursor = *pos;
} }
} }
curwin->w_cursor = cursor_save; curwin->w_cursor = cursor_save;

File diff suppressed because it is too large Load Diff