Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions src/AppMenuSearch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,28 @@ QList<AppMenuSearch::SearchResult> AppMenuSearch::matchSearchCandidates(const QS

bool skippedTopLevel = false;
for (QAction *ancestor : std::as_const(candidate.ancestors)) {
if (ancestor) {
const QString text = getActionText(ancestor);
if (!text.isEmpty()) {
currentPath.append(text);
if (ignoreTopLevel && !skippedTopLevel) {
skippedTopLevel = true;
} else {
evalPathList.append(text);
}
if (!ancestor) {
continue;
}

// If we've already computed a MatchState for this ancestor earlier in
// this search pass, reuse its .text to avoid an extra getActionText() call.
QString text;
auto it = matchCache.find(ancestor);
if (it != matchCache.end()) {
text = it.value().text;
} else {
// Do not insert a synthetic entry into matchCache here: we only want
// to read previously-computed values to avoid polluting the cache.
text = getActionText(ancestor);
}

if (!text.isEmpty()) {
currentPath.append(text);
if (ignoreTopLevel && !skippedTopLevel) {
skippedTopLevel = true;
} else {
evalPathList.append(text);
}
}
}
Expand Down
Loading