Mercurial > vim
comparison src/cindent.c @ 28353:8bc8071928ed v8.2.4702
patch 8.2.4702: C++ scope labels are hard-coded
Commit: https://github.com/vim/vim/commit/3506cf34c17c5eae6c2d1317db1fcd5a8493c288
Author: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
Date: Thu Apr 7 12:39:08 2022 +0100
patch 8.2.4702: C++ scope labels are hard-coded
Problem: C++ scope labels are hard-coded.
Solution: Add 'cinscopedecls' to define the labels. (Rom Praschan,
closes #10109)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 07 Apr 2022 13:45:04 +0200 |
parents | fb4c30606b4a |
children | f1a3df11d013 |
comparison
equal
deleted
inserted
replaced
28352:10886e23615f | 28353:8bc8071928ed |
---|---|
421 | 421 |
422 /* | 422 /* |
423 * Recognize a "public/private/protected" scope declaration label. | 423 * Recognize a "public/private/protected" scope declaration label. |
424 */ | 424 */ |
425 static int | 425 static int |
426 cin_isscopedecl(char_u *s) | 426 cin_isscopedecl(char_u *p) |
427 { | 427 { |
428 int i; | 428 size_t cinsd_len; |
429 | 429 char_u *cinsd_buf; |
430 s = cin_skipcomment(s); | 430 char_u *cinsd; |
431 if (STRNCMP(s, "public", 6) == 0) | 431 size_t len; |
432 i = 6; | 432 char_u *skip; |
433 else if (STRNCMP(s, "protected", 9) == 0) | 433 char_u *s = cin_skipcomment(p); |
434 i = 9; | 434 |
435 else if (STRNCMP(s, "private", 7) == 0) | 435 cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1; |
436 i = 7; | 436 cinsd_buf = alloc(cinsd_len); |
437 else | 437 if (cinsd_buf != NULL) |
438 return FALSE; | 438 { |
439 return (*(s = cin_skipcomment(s + i)) == ':' && s[1] != ':'); | 439 for (cinsd = curbuf->b_p_cinsd; *cinsd; ) |
440 { | |
441 len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ","); | |
442 if (STRNCMP(s, cinsd_buf, len) == 0) | |
443 { | |
444 skip = cin_skipcomment(s + len); | |
445 if (*skip == ':' && skip[1] != ':') | |
446 return TRUE; | |
447 } | |
448 } | |
449 | |
450 vim_free(cinsd_buf); | |
451 } | |
452 | |
453 return FALSE; | |
440 } | 454 } |
441 | 455 |
442 /* | 456 /* |
443 * Recognize a preprocessor statement: Any line that starts with '#'. | 457 * Recognize a preprocessor statement: Any line that starts with '#'. |
444 */ | 458 */ |