small block highlighting cleanup for the no-wrapping case with overlong lines

This commit is contained in:
mae
2009-04-23 20:11:00 +02:00
parent a180345b16
commit dfd2c5dbc3

View File

@@ -1746,11 +1746,11 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor); painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor);
} }
// keep right margin clean from full-width selection // // keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), documentLayout->documentSize().width()) // int maxX = offset.x() + qMax((qreal)viewportRect.width(), documentLayout->documentSize().width())
- doc->documentMargin(); // - doc->documentMargin();
er.setRight(qMin(er.right(), maxX)); // er.setRight(qMin(er.right(), maxX));
painter.setClipRect(er); // painter.setClipRect(er);
bool editable = !isReadOnly(); bool editable = !isReadOnly();
@@ -1804,9 +1804,11 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
int count = d->m_highlightBlocksInfo.visualIndent.size(); int count = d->m_highlightBlocksInfo.visualIndent.size();
if (count) { if (count) {
QRectF rr = r;
rr.setWidth(viewport()->width());
for(int i = 0; i <= depth; ++i) { for(int i = 0; i <= depth; ++i) {
int vi = i > 0 ? d->m_highlightBlocksInfo.visualIndent.at(i-1) : 0; int vi = i > 0 ? d->m_highlightBlocksInfo.visualIndent.at(i-1) : 0;
painter.fillRect(r.adjusted(vi, 0, 0, 0), calcBlendColor(baseColor, count - i)); painter.fillRect(rr.adjusted(vi, 0, -8*i, 0), calcBlendColor(baseColor, count - i));
} }
} }
} }