aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2021-08-03 14:19:44 +0200
committerEike Ziller <eike.ziller@qt.io>2021-08-03 14:19:44 +0200
commit17d716118a33df720c4acc06490a8fb02e83ec1d (patch)
treeff2254ccd3be831dee7a254a7f6aa181a48a6d6a /src/plugins/cpptools
parent91d3d83eabc6372e33e6a7553488d6086fd2d84b (diff)
parentf0bc9036f8e685b8122eb36a48154b0dcf1a5532 (diff)
Merge remote-tracking branch 'origin/5.0'
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/semantichighlighter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/cpptools/semantichighlighter.cpp b/src/plugins/cpptools/semantichighlighter.cpp
index 67ce04e042..d30f4d97c5 100644
--- a/src/plugins/cpptools/semantichighlighter.cpp
+++ b/src/plugins/cpptools/semantichighlighter.cpp
@@ -210,7 +210,13 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to)
}
QTC_ASSERT(paren.pos != -1, continue);
paren.source = parenSource();
- parentheses.second << paren;
+
+ static const auto posCmp = [](const Parenthesis &p1, const Parenthesis &p2) {
+ return p1.pos < p2.pos;
+ };
+ const auto it = std::lower_bound(parentheses.second.begin(), parentheses.second.end(),
+ paren, posCmp);
+ parentheses.second.insert(it, paren);
}
if (parentheses.first.isValid())
TextDocumentLayout::setParentheses(parentheses.first, parentheses.second);