From 32229e30b49f08b7f0b11f7ceae0fd0b78e46af2 Mon Sep 17 00:00:00 2001
From: mae <qt-info@nokia.com>
Date: Wed, 9 Sep 2009 14:58:47 +0200
Subject: [PATCH] mark all-whitespace-lines with the correct visual format.

---
 src/plugins/cppeditor/cpphighlighter.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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