From 7cc970ce5ad582f52f88b8216bc244adad476592 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 14 Dec 2023 09:26:07 +0100 Subject: [PATCH] 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 --- src/plugins/texteditor/texteditor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 1495003c79c..88d575f4780 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7825,10 +7825,13 @@ void TextEditorWidgetPrivate::setExtraSelections(Id kind, const QListsetVisible(!m_overlay->isEmpty()); } else { - QList all; + QList 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(); }