diff options
author | Ken Moore <moorekou@gmail.com> | 2016-04-21 10:28:15 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-04-21 10:28:15 -0400 |
commit | 054063554d2b6451ad3e8bf82c831a08cf42a62e (patch) | |
tree | c6aa43a5a6c71400113f375abf69ff076e87e6f4 | |
parent | Make the bracket highlighting also check the previous character if nothing fo... (diff) | |
download | lumina-054063554d2b6451ad3e8bf82c831a08cf42a62e.tar.gz lumina-054063554d2b6451ad3e8bf82c831a08cf42a62e.tar.bz2 lumina-054063554d2b6451ad3e8bf82c831a08cf42a62e.zip |
Fix up the syntax rule for highlighting quoted string. Now it will properly work for multiple strings on a single line, and ignore escaped quotes as necessary.
-rw-r--r-- | desktop-utilities/lumina-textedit/syntaxSupport.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/desktop-utilities/lumina-textedit/syntaxSupport.cpp b/desktop-utilities/lumina-textedit/syntaxSupport.cpp index 617cebae..7be190d2 100644 --- a/desktop-utilities/lumina-textedit/syntaxSupport.cpp +++ b/desktop-utilities/lumina-textedit/syntaxSupport.cpp @@ -71,7 +71,7 @@ void Custom_Syntax::loadRules(QString type){ //Quotes rule.format.setForeground( QColor(settings->value("colors/text").toString()) ); rule.format.setFontWeight(QFont::Normal); - rule.pattern = QRegExp("\".*\""); + rule.pattern = QRegExp( "\"[^\"\\\\]*(\\\\(.|\\n)[^\"\\\\]*)*\"|'[^'\\\\]*(\\\\(.|\\n)[^'\\\\]*)*'"); rules << rule; //Functions rule.format.setForeground( QColor(settings->value("colors/function").toString()) ); @@ -114,7 +114,7 @@ void Custom_Syntax::loadRules(QString type){ //Quotes rule.format.setForeground( QColor(settings->value("colors/text").toString()) ); rule.format.setFontWeight(QFont::Normal); - rule.pattern = QRegExp("\".*\""); + rule.pattern = QRegExp( "\"[^\"\\\\]*(\\\\(.|\\n)[^\"\\\\]*)*\"|'[^'\\\\]*(\\\\(.|\\n)[^'\\\\]*)*'"); rules << rule; //Functions rule.format.setForeground( QColor(settings->value("colors/function").toString()) ); @@ -173,7 +173,7 @@ void Custom_Syntax::loadRules(QString type){ //Quotes rule.format.setForeground( QColor(settings->value("colors/text").toString()) ); rule.format.setFontWeight(QFont::Normal); - rule.pattern = QRegExp("\".*\""); + rule.pattern = QRegExp( "\"[^\"\\\\]*(\\\\(.|\\n)[^\"\\\\]*)*\"|'[^'\\\\]*(\\\\(.|\\n)[^'\\\\]*)*'"); rules << rule; //Functions rule.format.setForeground( QColor(settings->value("colors/function").toString()) ); |