]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1767: '.-' no allowed in highlight group names v9.0.1767
authorGregory Anders <greg@gpanders.com>
Sun, 20 Aug 2023 17:14:03 +0000 (19:14 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 20 Aug 2023 17:14:03 +0000 (19:14 +0200)
Problem:  '.-' no allowed in highlight group names
Solution: Allow dot and hyphen characters in highlight group names

Allow dots and hyphens in group names. There does not seem
to be any reason for these to be disallowed.

closes: #12807

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
runtime/doc/syntax.txt
src/highlight.c
src/version.c

index 8a5e5f4c9c658803eb60c24a6a53ad56e71d76f9..17f81391a9d30ea66dcc2f1bb59f894015563e7c 100644 (file)
@@ -214,10 +214,10 @@ A syntax group name is to be used for syntax items that match the same kind of
 thing.  These are then linked to a highlight group that specifies the color.
 A syntax group name doesn't specify any color or attributes itself.
 
-The name for a highlight or syntax group must consist of ASCII letters, digits
-and the underscore.  As a regexp: "[a-zA-Z0-9_]*".  However, Vim does not give
-an error when using other characters.  The maximum length of a group name is
-about 200 bytes.  *E1249*
+The name for a highlight or syntax group must consist of ASCII letters,
+digits, underscores, dots, or hyphens.  As a regexp: "[a-zA-Z0-9_.-]*".
+However, Vim does not give an error when using other characters.  The maximum
+length of a group name is about 200 bytes.  *E1249*
 
 To be able to allow each user to pick their favorite set of colors, there must
 be preferred names for highlight groups that are common for many languages.
index 3773ddf70b398f9bf96af83f5c34a650cb5db000..8b1e832d7bd4a6d64dd795c6c40ab2416ed20276 100644 (file)
@@ -3452,7 +3452,7 @@ syn_add_group(char_u *name)
     char_u     *p;
     char_u     *name_up;
 
-    // Check that the name is ASCII letters, digits and underscore.
+    // Check that the name is valid (ASCII letters, digits, underscores, dots, or hyphens).
     for (p = name; *p != NUL; ++p)
     {
        if (!vim_isprintc(*p))
@@ -3461,7 +3461,7 @@ syn_add_group(char_u *name)
            vim_free(name);
            return 0;
        }
-       else if (!ASCII_ISALNUM(*p) && *p != '_')
+       else if (!ASCII_ISALNUM(*p) && *p != '_' && *p != '.' && *p != '-')
        {
            // This is an error, but since there previously was no check only
            // give a warning.
index 056dc2967981bd74d3e166ed512a3d22846b3ac5..e6f41a4a2f0a59d54f8e692903013d46f53f9cc5 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1767,
 /**/
     1766,
 /**/