forked from qt-creator/qt-creator
Profile editor: Add proper format to white spaces.
The generic highlighter already provided a method for this. This method was then lifted to the base syntax highlighter and it is now used by the profile highlighter. Reviewed-by: Roberto Raggi Task-number: QTCREATORBUG-2448
This commit is contained in:
@@ -535,6 +535,22 @@ void SyntaxHighlighter::setFormat(int start, int count, const QFont &font)
|
||||
setFormat(start, count, format);
|
||||
}
|
||||
|
||||
void SyntaxHighlighter::applyFormatToSpaces(const QString &text, const QTextCharFormat &format)
|
||||
{
|
||||
int offset = 0;
|
||||
const int length = text.length();
|
||||
while (offset < length) {
|
||||
if (text.at(offset).isSpace()) {
|
||||
int start = offset++;
|
||||
while (offset < length && text.at(offset).isSpace())
|
||||
++offset;
|
||||
setFormat(start, offset - start, format);
|
||||
} else {
|
||||
++offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QTextCharFormat SyntaxHighlighter::format(int position) const
|
||||
|
||||
|
||||
Reference in New Issue
Block a user