forked from qt-creator/qt-creator
TextEditor: fix selection highlight
Also compare the anchor when looking for the selection. Otherwise we might get a selection highlight that expands on adjacent extra selections like code model warnings. Change-Id: Ib8460c1089ed69d14b7a408ca70e7ac1f8642f6e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4745,7 +4745,8 @@ void TextEditorWidgetPrivate::setupSelections(const PaintEventData &data,
|
|||||||
o.start = ts.positionAtColumn(text, m_blockSelection.firstVisualColumn());
|
o.start = ts.positionAtColumn(text, m_blockSelection.firstVisualColumn());
|
||||||
o.length = ts.positionAtColumn(text, m_blockSelection.lastVisualColumn()) - o.start;
|
o.length = ts.positionAtColumn(text, m_blockSelection.lastVisualColumn()) - o.start;
|
||||||
}
|
}
|
||||||
if (data.textCursor.hasSelection() && data.textCursor == range.cursor) {
|
if (data.textCursor.hasSelection() && data.textCursor == range.cursor
|
||||||
|
&& data.textCursor.anchor() == range.cursor.anchor()) {
|
||||||
const QTextCharFormat selectionFormat = data.fontSettings.toTextCharFormat(C_SELECTION);
|
const QTextCharFormat selectionFormat = data.fontSettings.toTextCharFormat(C_SELECTION);
|
||||||
if (selectionFormat.background().style() != Qt::NoBrush)
|
if (selectionFormat.background().style() != Qt::NoBrush)
|
||||||
o.format.setBackground(selectionFormat.background());
|
o.format.setBackground(selectionFormat.background());
|
||||||
|
Reference in New Issue
Block a user