Commit 01abd0d5 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Only match filename by default in quickopen

Firstly, I think it was just a very poor decision to match both if
filename matched. When filename got matched, it is unnecessary to match
the path and can lead to worse results if we do it. Consider files:


First file match will happen, which most likely gives us the first file
for a pattern "fv". But then path matching which can ruin this result
and give some other irrelevant match a higher score leading to worse
results in quickopen

In kate, we work with files (from a user POV). User mostly sees filename
and will most likely be matching against file names, and rarely against

The other benefit that this gives is HUGELY better performance. This is
atleast 2x faster, so with large repos quick open will be much nicer to

if one really wants to match a path, then specifying a pattern like:


will do it. This is already supported, so it isn't something new.
parent 5345f483
......@@ -79,7 +79,7 @@ protected:
bool res = filterByName(QStringView(, name.size()), QStringView(, pattern.size()), score);
// only match file path if filename got a match
if (res || pathLike) {
if (matchPath) {
int scorep = 0;
QStringView path{sm->idxToFilePath(sourceRow)};
bool resp = filterByPath(path, QStringView(, pattern.size()), scorep);
......@@ -103,7 +103,7 @@ public Q_SLOTS:
pattern = splitted;
pathLike = pattern.contains(QLatin1Char('/'));
matchPath = pattern.contains(QLatin1Char('/'));
return true;
......@@ -122,7 +122,7 @@ private:
QString pattern;
bool pathLike = false;
bool matchPath = false;
class QuickOpenStyleDelegate : public QStyledItemDelegate
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment