From 8c57d6137818cbd6a766e11e8e1799afb692002d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 19 Apr 2016 12:18:55 -0400 Subject: Some more work on lumina-textedit. --- .../lumina-textedit/syntaxSupport.cpp | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'desktop-utilities/lumina-textedit/syntaxSupport.cpp') diff --git a/desktop-utilities/lumina-textedit/syntaxSupport.cpp b/desktop-utilities/lumina-textedit/syntaxSupport.cpp index 521a194f..2d00201f 100644 --- a/desktop-utilities/lumina-textedit/syntaxSupport.cpp +++ b/desktop-utilities/lumina-textedit/syntaxSupport.cpp @@ -19,7 +19,8 @@ QStringList Custom_Syntax::knownColors(){ QStringList avail; //Standard colors avail << "keyword" << "altkeyword" << "class" << "text" << "function" << "comment"; - + //Bracket/parenthesis/brace matching + avail << "bracket-found" << "bracket-missing"; return avail; } @@ -31,6 +32,8 @@ void Custom_Syntax::SetupDefaultColors(QSettings *settings){ settings->setValue("colors/text", QColor(Qt::darkMagenta).name() ); settings->setValue("colors/function", QColor(Qt::darkCyan).name() ); settings->setValue("colors/comment", QColor(Qt::darkGreen).name() ); + settings->setValue("colors/bracket-found", QColor(Qt::green).name() ); + settings->setValue("colors/bracket-missing", QColor(Qt::red).name() ); } QString Custom_Syntax::ruleForFile(QString filename){ @@ -135,7 +138,7 @@ void Custom_Syntax::loadRules(QString type){ rules << rule; } //Directives - /*keywords.clear(); + keywords.clear(); keywords << "image" << "figure" << "contents" << "container" << "rubric" << "topic" << "sidebar" \ << "parsed-literal" << "epigraph" << "highlights" << "pull-quote" << "compound" << "table" << "csv-table" \ << "list-table" << "raw" << "include"<< "class" << "meta" << "title" << "default-role" << "role"; @@ -143,27 +146,25 @@ void Custom_Syntax::loadRules(QString type){ for(int i=0; ivalue("colors/class").toString()) ); - //rule.pattern = QRegExp("\\bQ[A-Za-z]+\\b"); - //rules << rule; //Quotes rule.format.setForeground( QColor(settings->value("colors/text").toString()) ); rule.format.setFontWeight(QFont::Normal); @@ -172,11 +173,11 @@ void Custom_Syntax::loadRules(QString type){ //Functions rule.format.setForeground( QColor(settings->value("colors/function").toString()) ); rule.pattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()"); - rules << rule;*/ + rules << rule; //Comment (single line) - //rule.format.setForeground( QColor(settings->value("colors/comment").toString()) ); - //rule.pattern = QRegExp("\\b\\.\\.\\ [^\n]*"); - //rules << rule; + rule.format.setForeground( QColor(settings->value("colors/comment").toString()) ); + rule.pattern = QRegExp("\\b[.]{2}[^\n]*"); + rules << rule; //Comment (multi-line) //SyntaxRuleSplit srule; //srule.format = rule.format; //re-use the single-line comment format -- cgit