diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-12 22:39:45 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-12 22:39:45 (GMT) |
commit | 1d9d3ef8044bb12036dbd8f363e14a60eeee3409 (patch) | |
tree | d2d590263162619d971007242961ca887cc8fe8a /src | |
parent | 8f986a339925f523e5bf19addce6c6e8bf8c9ec3 (diff) |
oops % should not be bold
Diffstat (limited to 'src')
-rw-r--r-- | src/highlighter.cc | 7 |
1 files changed, 2 insertions, 5 deletions
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 ); |