From fa3b5e38a8867bd3ff736beff1e9af243c8ffdfd Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Mon, 11 May 2009 11:53:41 +0200
Subject: [PATCH] Improved highligting of bindings.

---
 src/shared/qscripthighlighter/qscripthighlighter.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/shared/qscripthighlighter/qscripthighlighter.cpp b/src/shared/qscripthighlighter/qscripthighlighter.cpp
index 1e7884e801d..5ab393eadb7 100644
--- a/src/shared/qscripthighlighter/qscripthighlighter.cpp
+++ b/src/shared/qscripthighlighter/qscripthighlighter.cpp
@@ -194,6 +194,8 @@ void QScriptHighlighter::highlightBlock(const QString &text)
     forever {
         const QChar c = text.at(i);
 
+        bool lookAtBinding = false;
+
         if (lastWasBackSlash) {
             input = InputSep;
         } else {
@@ -258,6 +260,7 @@ void QScriptHighlighter::highlightBlock(const QString &text)
                               QChar nextChar = ' ';
                               if (i < text.length() - 1)
                                   nextChar = text.at(i + 1);
+
                               if (state == StateStandard && !questionMark &&
                                   lastChar != ':' && nextChar != ':') {
                                   int start = i - 1;
@@ -278,6 +281,8 @@ void QScriptHighlighter::highlightBlock(const QString &text)
 
                                   ++start;
 
+                                  lookAtBinding = true;
+
                                   if (m_duiEnabled && text.midRef(start, lastNonSpace - start) == QLatin1String("id")) {
                                       setFormat(start, i - start, m_formats[KeywordFormat]);
                                   } else {
@@ -317,7 +322,8 @@ void QScriptHighlighter::highlightBlock(const QString &text)
                                         setFormat(i - 1, 1, emptyFormat);
                                     makeLastStandard = false;
                                     if (!buffer.isEmpty() && input != InputAlpha ) {
-                                        highlightKeyword(i, buffer);
+                                        if (! lookAtBinding)
+                                            highlightKeyword(i, buffer);
                                         buffer.clear();
                                     }
                                 } break;
-- 
GitLab