Commit b2d6c11e authored by Florian Müllner's avatar Florian Müllner Committed by Florian Müllner

systemActions: Filter out empty (folded) terms

We split the search string into words using whitespace, while
GLib.tokenize_and_fold() splits on any non-alphanumeric characters.

That is, a valid search term like ',' will be tokenized as [], so
the original non-empty terms may get mapped to an empty array.

And as [].every() returns true for any condition[0], we end up
matching *all* system actions in that case. We want the exact
opposite and not return any results, so handle that case explicitly.


parent 59ade00b
Pipeline #214003 passed with stages
in 4 minutes and 21 seconds
......@@ -269,6 +269,10 @@ const SystemActions = GObject.registerClass({
terms =
term => GLib.str_tokenize_and_fold(term, null)[0]).flat(2);
// tokenizing may return an empty array
if (terms.length === 0)
return [];
let results = [];
for (let [key, { available, keywords }] of this._actions) {
Markdown is supported
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