From f3a3ce92650042e4025fe0b9fc0ad748306ae71a Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 29 Apr 2010 00:19:15 +0000 Subject: Fix for bug #1683672 CSS lexer - Open comment causes highlighting error --- src/LexCSS.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/LexCSS.cxx b/src/LexCSS.cxx index 3b139cdcd..25f974e63 100644 --- a/src/LexCSS.cxx +++ b/src/LexCSS.cxx @@ -62,6 +62,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo int lastState = -1; // before operator int lastStateC = -1; // before comment + int lastStateS = -1; // before single-quoted/double-quoted string int op = ' '; // last operator int opPrev = ' '; // last operator @@ -105,7 +106,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo i--; if ((sc.currentPos - i) % 2 == 1) continue; - sc.ForwardSetState(SCE_CSS_VALUE); + sc.ForwardSetState(lastStateS); } if (sc.state == SCE_CSS_OPERATOR) { @@ -280,7 +281,9 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo lastStateC = sc.state; sc.SetState(SCE_CSS_COMMENT); sc.Forward(); - } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { + } else if ((sc.state == SCE_CSS_VALUE || sc.state == SCE_CSS_ATTRIBUTE) + && (sc.ch == '\"' || sc.ch == '\'')) { + lastStateS = sc.state; sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); } else if (IsCssOperator(sc.ch) && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') -- cgit v1.2.3