From kwrite-devel Fri Sep 03 21:45:10 2004 From: Martijn Klingens Date: Fri, 03 Sep 2004 21:45:10 +0000 To: kwrite-devel Subject: kdelibs/kate/part Message-Id: <20040903214510.13C79903E () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kwrite-devel&m=109424792916463 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