From d143f0c2e1b7780d090bbf95d56e4a1319d7abf8 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 26 Sep 2022 10:55:09 +0200 Subject: [PATCH] Core: improve highlighting of fuzzy action matches Split the highlight if it covers the border. Change-Id: I9177abf18e988b8c2f79ab355a1f17ad3bda4286 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/actionsfilter.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/actionsfilter.cpp b/src/plugins/coreplugin/actionsfilter.cpp index d7d3b06bae5..fd27fefdf20 100644 --- a/src/plugins/coreplugin/actionsfilter.cpp +++ b/src/plugins/coreplugin/actionsfilter.cpp @@ -110,8 +110,8 @@ QList ActionsFilter::matchesFor(QFutureInterface ActionsFilter::matchesFor(QFutureInterface border) { - // skip this highlight since it starts before and ends after the border - // between the concatenated strings + const int firstStart = start; + const int firstLength = border - start; + const int secondStart = 0; + const int secondLength = length - firstLength - 1; + if (first == Highlight::DisplayName) { + highlight.startsDisplay.append(firstStart); + highlight.lengthsDisplay.append(firstLength); + highlight.startsExtraInfo.append(secondStart); + highlight.lengthsExtraInfo.append(secondLength); + } else { + highlight.startsExtraInfo.append(firstStart); + highlight.lengthsExtraInfo.append(firstLength); + highlight.startsDisplay.append(secondStart); + highlight.lengthsDisplay.append(secondLength); + } continue; } if (type == Highlight::DisplayName) {