Skip to content
Permalink
Browse files

Fix expression builder highlighting (#4913)

  • Loading branch information
wonder-sk committed Jan 31, 2012
1 parent 6a44e11 commit f854acb1b0dbb1fd15fa447c5fda2219f99ae925
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/gui/qgsexpressionhighlighter.cpp
@@ -50,6 +50,8 @@ void QgsExpressionHighlighter::addFields( QStringList fieldList )
HighlightingRule rule;
foreach( const QString field, fieldList )
{
if ( field.isEmpty() ) // this really happened :)
continue;
rule.pattern = QRegExp( "\\b" + field + "\\b" );
rule.format = columnNameFormat;
highlightingRules.append( rule );
@@ -65,6 +67,8 @@ void QgsExpressionHighlighter::highlightBlock( const QString &text )
while ( index >= 0 )
{
int length = expression.matchedLength();
if ( length == 0 )
break; // avoid infinite loops
setFormat( index, length, rule.format );
index = expression.indexIn( text, index + length );
}

0 comments on commit f854acb

Please sign in to comment.
You can’t perform that action at this time.