TextEditor: Sort extraSelections

When applied to the QPlainTextEdit, the first selection for a range wins.
We want "OtherSelection" which is used for links to win, so we "sort"
it to the beginning of the final list.

Change-Id: Idf84c92ad5bd12d9f6ad6381f7e556e51ee459a9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-12-14 09:26:07 +01:00
parent 348ac80f4a
commit 7cc970ce5a

View File

@@ -7825,10 +7825,13 @@ void TextEditorWidgetPrivate::setExtraSelections(Id kind, const QList<QTextEdit:
}
m_overlay->setVisible(!m_overlay->isEmpty());
} else {
QList<QTextEdit::ExtraSelection> all;
QList<QTextEdit::ExtraSelection> all = m_extraSelections.value(
TextEditorWidget::OtherSelection);
for (auto i = m_extraSelections.constBegin(); i != m_extraSelections.constEnd(); ++i) {
if (i.key() == TextEditorWidget::CodeSemanticsSelection
|| i.key() == TextEditorWidget::SnippetPlaceholderSelection)
|| i.key() == TextEditorWidget::SnippetPlaceholderSelection
|| i.key() == TextEditorWidget::OtherSelection)
continue;
all += i.value();
}