From 1d9d3ef8044bb12036dbd8f363e14a60eeee3409 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 12 Jan 2013 16:39:45 -0600 Subject: oops % should not be bold diff --git a/src/highlighter.cc b/src/highlighter.cc index 45ba7f0..a636827 100644 --- a/src/highlighter.cc +++ b/src/highlighter.cc @@ -155,9 +155,6 @@ Highlighter::Highlighter(QTextDocument *parent) commentFormat.setForeground(Qt::darkCyan); errorFormat.setBackground(Qt::red); - // format tweaks - formatMap[ "%" ].setFontWeight(QFont::Bold); - lastErrorBlock = parent->begin(); } @@ -216,13 +213,13 @@ void Highlighter::highlightBlock(const QString &text) QString newtext = text; QStringList splitHelpers; QStringList::iterator sh, token; - int tokindex = -1; // tokindex helps w duplicate tokens in a single block + // splitHelpers - so "a+b" is treated as "a + b" and formatted splitHelpers << tokentypes["operator"] << "(" << ")" << "[" << "]"; for ( sh = splitHelpers.begin(); sh!=splitHelpers.end(); ++sh ) { - // so "a+b" is treated as "a + b" and formatted newtext = newtext.replace( *sh, " " + *sh + " "); } QStringList tokens = newtext.split(QRegExp("\\s")); + int tokindex = -1; // tokindex helps w duplicate tokens in a single block for ( token = tokens.begin(); token!=tokens.end(); ++token ){ if ( formatMap.contains( *token ) ) { tokindex = text.indexOf( *token, tokindex+1 ); -- cgit v0.10.1