summaryrefslogtreecommitdiffstats
path: root/src/cindent.c
diff options
context:
space:
mode:
authorTom Praschan <13141438+tom-anders@users.noreply.github.com>2022-04-07 12:39:08 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-07 12:39:08 +0100
commit3506cf34c17c5eae6c2d1317db1fcd5a8493c288 (patch)
tree7a93cd7c69e55b1ee9e170d8efb62e75f67087fd /src/cindent.c
parent3ad2090316edc85e93094bba7af64f9991cc7f85 (diff)
patch 8.2.4702: C++ scope labels are hard-codedv8.2.4702
Problem: C++ scope labels are hard-coded. Solution: Add 'cinscopedecls' to define the labels. (Rom Praschan, closes #10109)
Diffstat (limited to 'src/cindent.c')
-rw-r--r--src/cindent.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/cindent.c b/src/cindent.c
index ca21c123e0..a22db9560e 100644
--- 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;
+ 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;
+ }
+ }
- 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] != ':');
+ vim_free(cinsd_buf);
+ }
+
+ return FALSE;
}
/*