Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/cindent.c +++ b/src/cindent.c @@ -423,20 +423,34 @@ cin_islabel_skip(char_u **s) * Recognize a "public/private/protected" scope declaration label. */ static int -cin_isscopedecl(char_u *s) +cin_isscopedecl(char_u *p) { - int i; - - s = cin_skipcomment(s); - if (STRNCMP(s, "public", 6) == 0) - i = 6; - else if (STRNCMP(s, "protected", 9) == 0) - i = 9; - else if (STRNCMP(s, "private", 7) == 0) - i = 7; - else - return FALSE; - return (*(s = cin_skipcomment(s + i)) == ':' && s[1] != ':'); + size_t cinsd_len; + char_u *cinsd_buf; + char_u *cinsd; + size_t len; + char_u *skip; + char_u *s = cin_skipcomment(p); + + cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1; + cinsd_buf = alloc(cinsd_len); + if (cinsd_buf != NULL) + { + for (cinsd = curbuf->b_p_cinsd; *cinsd; ) + { + len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ","); + if (STRNCMP(s, cinsd_buf, len) == 0) + { + skip = cin_skipcomment(s + len); + if (*skip == ':' && skip[1] != ':') + return TRUE; + } + } + + vim_free(cinsd_buf); + } + + return FALSE; } /*