improve search behavior in edge cases

master
Alexander Lohnau 6 years ago
parent 5325780f76
commit 8e80b5de54
  1. 4
      pass.cpp
  2. 3
      pass.h

@ -159,8 +159,8 @@ void Pass::match(Plasma::RunnerContext &context)
auto input = context.query(); auto input = context.query();
// If we use the prefix we want to remove it // If we use the prefix we want to remove it
if (input.startsWith(queryPrefix)) { if (input.contains(queryPrefix)) {
input = input.remove(queryPrefix).simplified(); input = input.remove(QLatin1String("pass")).simplified();
} else if (input.count() < 3 && !context.singleRunnerQueryMode()) { } else if (input.count() < 3 && !context.singleRunnerQueryMode()) {
return; return;
} }

@ -23,6 +23,7 @@
#include <QDir> #include <QDir>
#include <QReadWriteLock> #include <QReadWriteLock>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QRegularExpression>
class Pass : public Plasma::AbstractRunner class Pass : public Plasma::AbstractRunner
{ {
@ -58,7 +59,7 @@ private:
bool showActions; bool showActions;
QList<QAction *> orderedActions; QList<QAction *> orderedActions;
const QLatin1String queryPrefix = QLatin1String("pass"); const QRegularExpression queryPrefix = QRegularExpression("^pass( .+)?$");
}; };
#endif #endif

Loading…
Cancel
Save