mark all-whitespace-lines with the correct visual format.

This commit is contained in:
mae
2009-09-09 14:58:47 +02:00
parent f269031b5e
commit 32229e30b4

View File

@@ -73,6 +73,8 @@ void CppHighlighter::highlightBlock(const QString &text)
userData->setCollapseMode(TextBlockUserData::NoCollapse); userData->setCollapseMode(TextBlockUserData::NoCollapse);
} }
TextEditDocumentLayout::clearParentheses(currentBlock()); TextEditDocumentLayout::clearParentheses(currentBlock());
if (text.length()) // the empty line can still contain whitespace
setFormat(0, text.length(), visualSpaceFormat);
return; return;
} }
@@ -171,7 +173,7 @@ void CppHighlighter::highlightBlock(const QString &text)
} }
// mark the trailing white spaces // mark the trailing white spaces
if (! tokens.isEmpty()) { {
const SimpleToken tk = tokens.last(); const SimpleToken tk = tokens.last();
const int lastTokenEnd = tk.position() + tk.length(); const int lastTokenEnd = tk.position() + tk.length();
if (text.length() > lastTokenEnd) if (text.length() > lastTokenEnd)