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

List:       kde-commits
Subject:    kdelibs/kate/part
From:       Martijn Klingens <klingens () kde ! org>
Date:       2004-09-03 21:14:28
Message-ID: 20040903211428.BCFC5903E () office ! kde ! org
[Download RAW message or body]

CVS commit by mklingens: 

One TODO less:

-  // TODO: genericise background painting

Painting for entire lines is aggregated in paintTextLineBackground since
aKademy, the painting of text blocks is now also generic.

It makes very little sense to combine these two as well, the version for
entire lines is a lot more efficient and does special processing that is
hard to do in the main loop (and not needed there).

At least there are now only two versions instead of the several slightly
different versions a week ago...


  M +22 -16    katerenderer.cpp   1.74


--- kdelibs/kate/part/katerenderer.cpp  #1.73:1.74
@@ -280,15 +280,11 @@ void KateRenderer::paintTextLine(QPainte
     len = endcol - startcol;
 
-  uint curCol = startcol;
-  uint nextCol = curCol + 1;
-
   // text attribs font/style data
   KateAttribute* attr = m_doc->m_highlight->attributes(m_schema)->data();
-  uint atLen = m_doc->m_highlight->attributes(m_schema)->size();
 
   const QColor *cursorColor = &attr[0].textColor();
 
   // Start arbitrary highlighting
-  KateTextCursor currentPos(line, curCol);
+  KateTextCursor currentPos(line, startcol);
   superRanges.firstBoundary(&currentPos);
 
@@ -316,5 +312,5 @@ void KateRenderer::paintTextLine(QPainte
   if (len < 1)
   {
-    if (showCursor && (cursor->col() >= int(curCol)))
+    if (showCursor && (cursor->col() >= int(startcol)))
     {
       cursorVisible = true;
@@ -342,4 +338,6 @@ void KateRenderer::paintTextLine(QPainte
 
     uint blockStartCol = startcol;
+    uint curCol = startcol;
+    uint nextCol = curCol + 1;
 
     // text + attrib data from line
@@ -350,4 +348,6 @@ void KateRenderer::paintTextLine(QPainte
     textAttributes = textAttributes + startcol;
 
+    uint atLen = m_doc->m_highlight->attributes(m_schema)->size();
+
     while (curCol - startcol < len)
     {
@@ -452,5 +452,7 @@ void KateRenderer::paintTextLine(QPainte
           {
             bool paintBackground = true;
+            uint width = xPosAfter - oldXPos;
             QColor fillColor;
+
             if (isIMSel && !isTab)
             {
@@ -470,5 +472,17 @@ void KateRenderer::paintTextLine(QPainte
             else if (!selectionPainted && (isSel || \
currentHL.itemSet(KateAttribute::BGColor)))  {
-              fillColor = isSel ? config()->selectionColor() : currentHL.bgColor();
+              if (isSel)
+              {
+                fillColor = config()->selectionColor();
+
+                // If this is the last block of text, fill up to the end of the line \
if the +                // selection stretches that far
+                if ((curCol >= len - 1) && m_doc->lineEndSelected (line, endcol))
+                  width = xEnd - oldXPos;
+              }
+              else
+              {
+                fillColor = currentHL.bgColor();
+              }
             }
             else
@@ -478,5 +492,5 @@ void KateRenderer::paintTextLine(QPainte
 
             if (paintBackground)
-              paint.fillRect(oldXPos - xStart, 0, xPosAfter - oldXPos, \
fs->fontHeight, fillColor); +              paint.fillRect(oldXPos - xStart, 0, width, \
fs->fontHeight, fillColor);  
             if (isIMSel && paintBackground && !isTab)
@@ -569,12 +583,4 @@ void KateRenderer::paintTextLine(QPainte
   }
 
-  // Draw dregs of the selection
-  // TODO: genericise background painting
-  if (!isPrinterFriendly() && showSelections() && !selectionPainted && \
                m_doc->lineEndSelected (line, endcol))
-  {
-    paint.fillRect(xPos-xStart, 0, xEnd - xStart, fs->fontHeight, \
                config()->selectionColor());
-    selectionPainted = true;
-  }
-
   // Paint cursor
   if (cursorVisible)


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

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