Commit 7d640fd4 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Highlight 'id:' bindings using the `keyword' format.

parent ecc4615d
......@@ -31,6 +31,7 @@
#include <QtCore/QSet>
#include <QtCore/QtAlgorithms>
#include <QtCore/QDebug>
namespace SharedTools {
......@@ -260,12 +261,27 @@ void QScriptHighlighter::highlightBlock(const QString &text)
if (state == StateStandard && !questionMark &&
lastChar != ':' && nextChar != ':') {
int start = i - 1;
// skip white spaces
for (; start != -1; --start) {
if (! text.at(start).isSpace())
break;
}
int lastNonSpace = start + 1;
for (; start != -1; --start) {
if (text.at(start).isSpace())
break;
}
++start;
setFormat(start, i - start, m_formats[LabelFormat]);
if (m_duiEnabled && text.midRef(start, lastNonSpace - start) == QLatin1String("id")) {
setFormat(start, i - start, m_formats[KeywordFormat]);
} else {
setFormat(start, i - start, m_formats[LabelFormat]);
}
}
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