From 2f7e246877428dc1af1b59f6944bd1101621d7eb Mon Sep 17 00:00:00 2001 From: Exarilo Date: Wed, 23 Oct 2024 21:24:47 +0200 Subject: [PATCH] Restore dynamic filtering while typing --- Main.cs | 7 +++++-- plugin.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Main.cs b/Main.cs index 1147dee..b82dd9e 100644 --- a/Main.cs +++ b/Main.cs @@ -71,10 +71,13 @@ public List Query(Query query) private bool MatchesSearch(SettingItem item, string fullSearch) { string searchKeyword = item.Keyword.Trim().ToLower(); + if (!fullSearch.StartsWith(searchKeyword, StringComparison.OrdinalIgnoreCase)) + return false; - string searchBeforeDash = fullSearch.Split('-')[0].Trim().ToLower(); + string remainingSearch = fullSearch.Substring(searchKeyword.Length).Trim(); - return searchBeforeDash.StartsWith(searchKeyword, StringComparison.OrdinalIgnoreCase); + return string.IsNullOrEmpty(remainingSearch) || remainingSearch.Split(' ') + .All(arg => item.Title.ToLower().Contains(arg)); } private List GetAndRemoveArgs(ref string query) diff --git a/plugin.json b/plugin.json index 1803b48..789ae23 100644 --- a/plugin.json +++ b/plugin.json @@ -4,7 +4,7 @@ "Name": "LinkOpener", "Description": "Allows you to open URLs using keywords set in the settings", "Author": "Exarilo", - "Version": "1.1.2", + "Version": "1.1.3", "Language": "csharp", "Website": "https://github.com/Exarilo/Flow.Launcher.Plugin.LinkOpener", "IcoPath": "Images\\app.png",