Commit fa3b5e38 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Improved highligting of bindings.

parent 7ae8cf75
...@@ -194,6 +194,8 @@ void QScriptHighlighter::highlightBlock(const QString &text) ...@@ -194,6 +194,8 @@ void QScriptHighlighter::highlightBlock(const QString &text)
forever { forever {
const QChar c = text.at(i); const QChar c = text.at(i);
bool lookAtBinding = false;
if (lastWasBackSlash) { if (lastWasBackSlash) {
input = InputSep; input = InputSep;
} else { } else {
...@@ -258,6 +260,7 @@ void QScriptHighlighter::highlightBlock(const QString &text) ...@@ -258,6 +260,7 @@ void QScriptHighlighter::highlightBlock(const QString &text)
QChar nextChar = ' '; QChar nextChar = ' ';
if (i < text.length() - 1) if (i < text.length() - 1)
nextChar = text.at(i + 1); nextChar = text.at(i + 1);
if (state == StateStandard && !questionMark && if (state == StateStandard && !questionMark &&
lastChar != ':' && nextChar != ':') { lastChar != ':' && nextChar != ':') {
int start = i - 1; int start = i - 1;
...@@ -278,6 +281,8 @@ void QScriptHighlighter::highlightBlock(const QString &text) ...@@ -278,6 +281,8 @@ void QScriptHighlighter::highlightBlock(const QString &text)
++start; ++start;
lookAtBinding = true;
if (m_duiEnabled && text.midRef(start, lastNonSpace - start) == QLatin1String("id")) { if (m_duiEnabled && text.midRef(start, lastNonSpace - start) == QLatin1String("id")) {
setFormat(start, i - start, m_formats[KeywordFormat]); setFormat(start, i - start, m_formats[KeywordFormat]);
} else { } else {
...@@ -317,7 +322,8 @@ void QScriptHighlighter::highlightBlock(const QString &text) ...@@ -317,7 +322,8 @@ void QScriptHighlighter::highlightBlock(const QString &text)
setFormat(i - 1, 1, emptyFormat); setFormat(i - 1, 1, emptyFormat);
makeLastStandard = false; makeLastStandard = false;
if (!buffer.isEmpty() && input != InputAlpha ) { if (!buffer.isEmpty() && input != InputAlpha ) {
highlightKeyword(i, buffer); if (! lookAtBinding)
highlightKeyword(i, buffer);
buffer.clear(); buffer.clear();
} }
} break; } break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment