forked from qt-creator/qt-creator
Locator: De-duplicate highlightInfo generation for camel humps
Change-Id: I5a3fd28ddd68b2ac17a76384cffad12064d06259 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
4d3ea43dbc
commit
62d971b30b
@@ -30,7 +30,6 @@
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <utils/camelhumpmatcher.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
@@ -96,14 +95,13 @@ QList<Core::LocatorFilterEntry> CppCurrentDocumentFilter::matchesFor(
|
||||
|
||||
Core::LocatorFilterEntry filterEntry(this, name, id, info->icon());
|
||||
filterEntry.extraInfo = extraInfo;
|
||||
if (!match.hasMatch()) {
|
||||
if (match.hasMatch()) {
|
||||
filterEntry.highlightInfo = highlightInfo(match);
|
||||
} else {
|
||||
match = regexp.match(extraInfo);
|
||||
filterEntry.highlightInfo.dataType = Core::LocatorFilterEntry::HighlightInfo::ExtraInfo;
|
||||
filterEntry.highlightInfo =
|
||||
highlightInfo(match, Core::LocatorFilterEntry::HighlightInfo::ExtraInfo);
|
||||
}
|
||||
const CamelHumpMatcher::HighlightingPositions positions =
|
||||
CamelHumpMatcher::highlightingPositions(match);
|
||||
filterEntry.highlightInfo.starts = positions.starts;
|
||||
filterEntry.highlightInfo.lengths = positions.lengths;
|
||||
|
||||
if (betterMatch)
|
||||
betterEntries.append(filterEntry);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/camelhumpmatcher.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
@@ -94,10 +93,7 @@ QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor(
|
||||
// to update the match if the displayName is different from matchString
|
||||
if (matchString != filterEntry.displayName)
|
||||
match = regexp.match(filterEntry.displayName);
|
||||
const CamelHumpMatcher::HighlightingPositions positions =
|
||||
CamelHumpMatcher::highlightingPositions(match);
|
||||
filterEntry.highlightInfo.starts = positions.starts;
|
||||
filterEntry.highlightInfo.lengths = positions.lengths;
|
||||
filterEntry.highlightInfo = highlightInfo(match);
|
||||
|
||||
if (matchString.startsWith(entry, caseSensitivityForPrefix))
|
||||
bestEntries.append(filterEntry);
|
||||
|
||||
Reference in New Issue
Block a user