Re: Fixed CSS's class name highlight was broken in some cases

2017-01-13 Fir de Conversatie Ryuichi Hayashida
2017年1月14日土曜日 5時53分05秒 UTC+9 Bram Moolenaar:
> Ryuichi Hayashida wrote:
> 
> > Hi Jules, Bram, and team
> > 
> > I found that highlight of CSS's class names is broken in below cases:
> > 
> > - class name is one character
> > - class name starts with under score
> > 
> > I fixed them. Please find attached css.vim.patch.
> > 
> > Repro: Execute below shell commands
> > 
> > -
> > 
> > $ cat <<-EOS > test.css
> > ._foo {
> >   margin: 0;
> > }
> > 
> > .a {
> >   margin: 0;
> > }
> > EOS
> > 
> > $ vim test.css
> > 
> > -
> 
> I believe a class name can also start with a dash:
> 
> .-foo {
>   margin: 0;
> }
> 
> The suggested pattern is:
> 
> -\=[_a-zA-Z][_a-zA-Z0-9-]*
> 
> -- 
> hundred-and-one symptoms of being an internet addict:
> 266. You hear most of your jokes via e-mail instead of in person.
> 
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org///

Thank you for your review.
I confirmed that you're correct with CSS spec.

https://www.w3.org/TR/CSS21/grammar.html#scanner

> ident -?{nmstart}{nmchar}*

I fixed my patch and attached it to this mail.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/syntax/css.vim b/runtime/syntax/css.vim
index 3dc3f5c..a66cbdc 100644
--- a/runtime/syntax/css.vim
+++ b/runtime/syntax/css.vim
@@ -56,7 +56,7 @@ syn match cssSelectorOp2 "[~|^$*]\?=" contained
 syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
 
 " .class and #id
-syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+" contains=cssClassNameDot
+syn match cssClassName "\.-\=[A-Za-z_][A-Za-z0-9_-]*" contains=cssClassNameDot
 syn match cssClassNameDot contained '\.'
 
 try


Re: Fixed CSS's class name highlight was broken in some cases

2017-01-13 Fir de Conversatie Bram Moolenaar

Ryuichi Hayashida wrote:

> Hi Jules, Bram, and team
> 
> I found that highlight of CSS's class names is broken in below cases:
> 
> - class name is one character
> - class name starts with under score
> 
> I fixed them. Please find attached css.vim.patch.
> 
> Repro: Execute below shell commands
> 
> -
> 
> $ cat <<-EOS > test.css
> ._foo {
>   margin: 0;
> }
> 
> .a {
>   margin: 0;
> }
> EOS
> 
> $ vim test.css
> 
> -

I believe a class name can also start with a dash:

.-foo {
  margin: 0;
}

The suggested pattern is:

-\=[_a-zA-Z][_a-zA-Z0-9-]*

-- 
hundred-and-one symptoms of being an internet addict:
266. You hear most of your jokes via e-mail instead of in person.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fixed CSS's class name highlight was broken in some cases

2017-01-13 Fir de Conversatie Ryuichi Hayashida
Hi Jules, Bram, and team

I found that highlight of CSS's class names is broken in below cases:

- class name is one character
- class name starts with under score

I fixed them. Please find attached css.vim.patch.

Repro: Execute below shell commands

-

$ cat <<-EOS > test.css
._foo {
  margin: 0;
}

.a {
  margin: 0;
}
EOS

$ vim test.css

-

My environment:

- macOS 10.12
- Vim 8.0-114 (MacVim)


Thanks,
Hayashida

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/syntax/css.vim b/runtime/syntax/css.vim
index 3dc3f5c..a66cbdc 100644
--- a/runtime/syntax/css.vim
+++ b/runtime/syntax/css.vim
@@ -56,7 +56,7 @@ syn match cssSelectorOp2 "[~|^$*]\?=" contained
 syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
 
 " .class and #id
-syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+" contains=cssClassNameDot
+syn match cssClassName "\.[A-Za-z_][A-Za-z0-9_-]*" contains=cssClassNameDot
 syn match cssClassNameDot contained '\.'
 
 try