diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index c192249862c..9ce003e8537 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4477,7 +4477,6 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data, const qreal indentAdvance = singleAdvance * data.tabSettings.m_indentSize; painter.save(); - painter.setPen(data.visualWhitespaceFormat.foreground().color()); const QTextLine textLine = blockData.layout->lineAt(0); const QRectF rect = textLine.naturalTextRect(); @@ -4485,6 +4484,16 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data, + singleAdvance * m_visualIndentOffset; int paintColumn = 0; + QList cursorPositions; + for (const QTextCursor & cursor : m_cursors) { + if (cursor.block() == data.block) + cursorPositions << cursor.positionInBlock(); + } + + const QColor normalColor = data.visualWhitespaceFormat.foreground().color(); + QColor cursorColor = normalColor; + cursorColor.setAlpha(cursorColor.alpha() / 2); + const QString text = data.block.text().mid(m_visualIndentOffset); while (paintColumn < depth) { if (x >= 0) { @@ -4493,6 +4502,10 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data, && blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0) { break; } + if (cursorPositions.contains(paintPosition)) + painter.setPen(cursorColor); + else + painter.setPen(normalColor); const QPointF top(x, blockData.boundingRect.top()); const QPointF bottom(x, blockData.boundingRect.top() + rect.height()); const QLineF line(top, bottom);