Commit 756de96d authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Don't clip the right margin indication

Doesn't look right, since it causes some background to show through
between the indicator and the scrollbar.
parent 9cdbb152
......@@ -1635,6 +1635,20 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
QRect er = e->rect();
QRect viewportRect = viewport()->rect();
const QColor baseColor = palette().base().color();
const int blendBase = (baseColor.value() > 128) ? 0 : 255;
// Darker backgrounds may need a bit more contrast
// (this calculation is temporary solution until we have a setting for this color)
const int blendFactor = (baseColor.value() > 128) ? 8 : 16;
const QColor blendColor(
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.green() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256);
if (d->m_visibleWrapColumn > 0) {
qreal lineX = fontMetrics().averageCharWidth() * d->m_visibleWrapColumn + offset.x() + 4;
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor);
}
// keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), documentLayout->documentSize().width())
- doc->documentMargin();
......@@ -1647,7 +1661,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
QAbstractTextDocumentLayout::PaintContext context = getPaintContext();
if (!d->m_findScope.isNull()) {
QAbstractTextDocumentLayout::Selection selection;
selection.format.setBackground(d->m_searchScopeFormat.background());
......@@ -1672,20 +1685,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
blockSelection->lastColumn = qMax(columnA, columnB) + d->m_blockSelectionExtraX;
}
const QColor baseColor = palette().base().color();
const int blendBase = (baseColor.value() > 128) ? 0 : 255;
// Darker backgrounds may need a bit more contrast
// (this calculation is temporary solution until we have a setting for this color)
const int blendFactor = (baseColor.value() > 128) ? 8 : 16;
const QColor blendColor(
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.green() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256);
if (d->m_visibleWrapColumn > 0) {
qreal lineX = fontMetrics().averageCharWidth() * d->m_visibleWrapColumn + offset.x() + 4;
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor);
}
QTextBlock visibleCollapsedBlock;
QPointF visibleCollapsedBlockOffset;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment