[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    kdelibs/kate/part
From:       Martijn Klingens <klingens () kde ! org>
Date:       2004-09-03 21:45:10
Message-ID: 20040903214510.13C79903E () office ! kde ! org
[Download RAW message or body]

CVS commit by mklingens: 

Finally I understand the renderer well enough to implement what I wanted
to add in the first place at aKademy: show trailing whitespace like vim
does when setting the 'listchars' variable (like kde-devel-vim.vim in
kdesdk does automatically).

One less reason for me not switching to KDevelop, time to tackle the next
one ;-)

(Incidentally this means that I consider my work on Kate done apart from
bugfixes or other itches to scratch. Whoever wants to touch the renderer,
please go ahead :)

CCMAIL: kwrite-devel@kde.org


  M +10 -2     katerenderer.cpp   1.75


--- kdelibs/kate/part/katerenderer.cpp  #1.74:1.75
@@ -350,4 +350,9 @@ void KateRenderer::paintTextLine(QPainte
     uint atLen = m_doc->m_highlight->attributes(m_schema)->size();
 
+    // Determine if we have trailing whitespace and store the column
+    uint trailingWhitespaceColumn = len;
+    while ((len > 0) && (trailingWhitespaceColumn > 0) && \
(textLine->string()[trailingWhitespaceColumn - 1]).isSpace()) +      \
trailingWhitespaceColumn--; +
     while (curCol - startcol < len)
     {
@@ -424,4 +429,7 @@ void KateRenderer::paintTextLine(QPainte
           || (curCol >= len - 1)
 
+          // the rest of the line is trailing whitespace OR
+          || (curCol + 1 >= trailingWhitespaceColumn)
+
           // the x position is past the end OR
           || ((int)xPos > xEnd)
@@ -506,5 +514,5 @@ void KateRenderer::paintTextLine(QPainte
           // make sure we redraw the right character groups on attrib/selection \
changes  // Special case... de-special case some of it
-          if (isTab)
+          if (isTab || (curCol >= trailingWhitespaceColumn))
           {
             // Draw spaces too, because it might be eg. underlined
@@ -513,5 +521,5 @@ void KateRenderer::paintTextLine(QPainte
               spaces.fill(' ', m_tabWidth);
 
-            paint.drawText(oldXPos-xStart, y, spaces);
+            paint.drawText(oldXPos-xStart, y, isTab ? spaces : QString(" "));
 
             if (showTabs())


_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic