Skip to content

Commit

Permalink
Fix expression builder highlighting (#4913)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Jan 31, 2012
1 parent 6a44e11 commit f854acb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gui/qgsexpressionhighlighter.cpp
Expand Up @@ -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 );
Expand All @@ -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 );
}
Expand Down

0 comments on commit f854acb

Please sign in to comment.