[gtksourceview] css.lang: Fix incorrect highlighting in certain nested at-rule cases



commit 94782d730115ca4f8d7294f89c788213fdbf5f41
Author: Jeffery To <jeffery to gmail com>
Date:   Fri May 18 03:59:37 2018 +0800

    css.lang: Fix incorrect highlighting in certain nested at-rule cases

 data/language-specs/css.lang       | 12 +++++++++++-
 tests/syntax-highlighting/file.css |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index 364239e9..35de11ed 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -1734,8 +1734,18 @@
       </include>
     </context>
 
+    <!--
+    if this was a simple context (<match>), then in a case like this:
+    @supports {
+        @import url();
+        @media screen {}
+    }
+    the @media rule would not be highlighted correctly
+    (seems like a bug?)
+    -->
     <context id="at-rule-delimiter" end-parent="true" style-ref="delimiter">
-      <match>;</match>
+      <start>(?=;)</start>
+      <end>;</end>
     </context>
 
     <context id="vendor-specific-at-rule">
diff --git a/tests/syntax-highlighting/file.css b/tests/syntax-highlighting/file.css
index a77c3ed6..d73b7227 100644
--- a/tests/syntax-highlighting/file.css
+++ b/tests/syntax-highlighting/file.css
@@ -111,6 +111,7 @@ div#\E9 dition .\0000E9dition .motion_\e9motion, /* Unicode character escape */
         background-image:         linear-gradient(to left top, #fff, blue);
         padding: 10VW;
     }
+    @import 'custom.css';
     @media screen, (orientation: portrait) {
         .heading > .news {
             background-image: url(image.png);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]