diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e98e95bc10..b3d8cd9cb0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2011-07-11 21:43 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp + * Fixed: wrongly highlighted text where single-line comment + is inside the quoted text, viz., "ABC//DEF" which is greyed + after "//", reported by Miso Pucko on the bug tracker. + 2011-07-12 00:10 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/win/global.mk * contrib/hbpost.hbm diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp index 03d3b5dae6..c9fa3dc95e 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp @@ -232,9 +232,11 @@ void HBQSyntaxHighlighter::highlightBlock( const QString &text ) /* Multi Line Comments - to ascertain if it is embedded in quotes */ int startIndex = 0; + int startSglLine = 0; if( previousBlockState() != 1 ) { startIndex = commentStartExpression.indexIn( text ); + startSglLine = commentSingleLine.indexIn( text ); } /* Quoted text */ @@ -247,18 +249,24 @@ void HBQSyntaxHighlighter::highlightBlock( const QString &text ) { startIndex = -1; } + if( startSglLine > index && startSglLine < index + length ) + { + startSglLine = -1; + } index = patternQuotation.indexIn( text, index + length ); } /* Single Line Comments */ - index = commentSingleLine.indexIn( text ); - while( index >= 0 ) + if( startSglLine >= 0 ) { - length = commentSingleLine.matchedLength(); - setFormat( index, length, singleLineCommentFormat ); - index = commentSingleLine.indexIn( text, index + length ); + index = commentSingleLine.indexIn( text ); + while( index >= 0 ) + { + length = commentSingleLine.matchedLength(); + setFormat( index, length, singleLineCommentFormat ); + index = commentSingleLine.indexIn( text, index + length ); + } } - /* Multi Line Comments - continued */ setCurrentBlockState( 0 );