forked from qt-creator/qt-creator
DiffEditor: Use settings' foreground color for highlights
Simplify drawing highlights by passing selections into a drawing function. Reduce selections which are covered completely by other selections. Task-number: QTCREATORBUG-12844 Change-Id: If282d5c881d25cac1b8db4ac8dfc45d47b0b8580 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -3454,7 +3454,6 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
|
||||
ifdefedOutFormat.background());
|
||||
}
|
||||
|
||||
innerPaintEvent(e);
|
||||
/*
|
||||
Here comes an almost verbatim copy of
|
||||
QPlainTextEdit::paintEvent() so we can adjust the extra
|
||||
@@ -3902,8 +3901,7 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
|
||||
}
|
||||
|
||||
|
||||
|
||||
layout->draw(&painter, offset, selections, er);
|
||||
paintBlock(&painter, block, offset, selections, er);
|
||||
|
||||
if ((drawCursor && !drawCursorAsBlock)
|
||||
|| (editable && context.cursorPosition < -1 && !layout->preeditAreaText().isEmpty())) {
|
||||
@@ -4113,6 +4111,15 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTextEditorWidget::paintBlock(QPainter *painter,
|
||||
const QTextBlock &block,
|
||||
const QPointF &offset,
|
||||
const QVector<QTextLayout::FormatRange> &selections,
|
||||
const QRect &clipRect) const
|
||||
{
|
||||
block.layout()->draw(painter, offset, selections, clipRect);
|
||||
}
|
||||
|
||||
int BaseTextEditorWidget::visibleFoldedBlockNumber() const
|
||||
{
|
||||
return d->visibleFoldedBlockNumber;
|
||||
|
||||
Reference in New Issue
Block a user