css-mode.el (css-smie-rules): Fix indentation after complex selectors

Fixes: debbugs:20282

* lisp/textmodes/css-mode.el (css-smie-rules): Don't get confused by
inner structure of selectors.
This commit is contained in:
Stefan Monnier 2015-04-09 10:51:23 -04:00
parent c9415ccbf8
commit 6083965958
2 changed files with 19 additions and 0 deletions

View file

@ -327,6 +327,10 @@
(`(:elem . basic) css-indent-offset)
(`(:elem . arg) 0)
(`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
(`(:before . "{")
(when (smie-rule-hanging-p)
(smie-backward-sexp ";")
(smie-indent-virtual)))
(`(:before . ,(or "{" "("))
(if (smie-rule-hanging-p) (smie-rule-parent 0)))))

View file

@ -8,6 +8,21 @@ article[role="main"] {
width: 60%;
}
a, b:hover, c {
color: black;
}
a, b:hover { /* bug:20282 */
c {
color: black;
}
color: black;
}
a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */
background-color: white;
}
/* asdfasdf */
@foo x2 {
bla:toto;