From 89bceecee4d6942e96ed01477f639c06a4d02aa2 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sun, 10 Apr 2022 05:36:35 -0400 Subject: [PATCH 1/5] Remove whitespace trim --- Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 0fe3bdf8052..a4f169c911a 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -569,7 +569,7 @@ private async void QueryResults() if (currentCancellationToken.IsCancellationRequested) return; - var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins); + var query = QueryBuilder.Build(QueryText, PluginManager.NonGlobalPlugins); // handle the exclusiveness of plugin using action keyword RemoveOldQueryResults(query); From 84cb555deee797df55daf5a7d500ac32cda720b0 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sun, 10 Apr 2022 05:36:46 -0400 Subject: [PATCH 2/5] Remove formatting --- Flow.Launcher.Core/Plugin/QueryBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Core/Plugin/QueryBuilder.cs b/Flow.Launcher.Core/Plugin/QueryBuilder.cs index ef387b693eb..0b736aed8a8 100644 --- a/Flow.Launcher.Core/Plugin/QueryBuilder.cs +++ b/Flow.Launcher.Core/Plugin/QueryBuilder.cs @@ -16,7 +16,7 @@ public static Query Build(string text, Dictionary nonGlobalP return null; } - var rawQuery = string.Join(Query.TermSeparator, terms); + var rawQuery = text; string actionKeyword, search; string possibleActionKeyword = terms[0]; string[] searchTerms; From 807ff70f504d3ffb41964de98f78e4633f8292f4 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sun, 10 Apr 2022 05:59:18 -0400 Subject: [PATCH 3/5] Update tests --- Flow.Launcher.Test/QueryBuilderTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Test/QueryBuilderTest.cs b/Flow.Launcher.Test/QueryBuilderTest.cs index 6090ecc65ea..af2b323d200 100644 --- a/Flow.Launcher.Test/QueryBuilderTest.cs +++ b/Flow.Launcher.Test/QueryBuilderTest.cs @@ -17,7 +17,7 @@ public void ExclusivePluginQueryTest() Query q = QueryBuilder.Build("> file.txt file2 file3", nonGlobalPlugins); - Assert.AreEqual("file.txt file2 file3", q.Search); + Assert.AreEqual(" file.txt file2 file3", q.Search); Assert.AreEqual(">", q.ActionKeyword); } @@ -31,7 +31,7 @@ public void ExclusivePluginQueryIgnoreDisabledTest() Query q = QueryBuilder.Build("> file.txt file2 file3", nonGlobalPlugins); - Assert.AreEqual("> file.txt file2 file3", q.Search); + Assert.AreEqual("> file.txt file2 file3", q.Search); } [Test] From a3630e46e388760809f7efed52efe483ee89c18d Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sun, 10 Apr 2022 08:42:54 -0400 Subject: [PATCH 4/5] Trim leading whitespace --- Flow.Launcher.Core/Plugin/QueryBuilder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/QueryBuilder.cs b/Flow.Launcher.Core/Plugin/QueryBuilder.cs index 0b736aed8a8..a819f94b7b0 100644 --- a/Flow.Launcher.Core/Plugin/QueryBuilder.cs +++ b/Flow.Launcher.Core/Plugin/QueryBuilder.cs @@ -24,13 +24,13 @@ public static Query Build(string text, Dictionary nonGlobalP if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPair) && !pluginPair.Metadata.Disabled) { // use non global plugin for query actionKeyword = possibleActionKeyword; - search = terms.Length > 1 ? rawQuery[(actionKeyword.Length + 1)..] : string.Empty; + search = terms.Length > 1 ? rawQuery[(actionKeyword.Length + 1)..].TrimStart() : string.Empty; searchTerms = terms[1..]; } else { // non action keyword actionKeyword = string.Empty; - search = rawQuery; + search = rawQuery.TrimStart(); searchTerms = terms; } From e8fba288b95a41748ab8e7e3359c08a2287e7908 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sun, 10 Apr 2022 08:44:14 -0400 Subject: [PATCH 5/5] Update test --- Flow.Launcher.Test/QueryBuilderTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Test/QueryBuilderTest.cs b/Flow.Launcher.Test/QueryBuilderTest.cs index af2b323d200..45ff8fc9ef3 100644 --- a/Flow.Launcher.Test/QueryBuilderTest.cs +++ b/Flow.Launcher.Test/QueryBuilderTest.cs @@ -17,7 +17,7 @@ public void ExclusivePluginQueryTest() Query q = QueryBuilder.Build("> file.txt file2 file3", nonGlobalPlugins); - Assert.AreEqual(" file.txt file2 file3", q.Search); + Assert.AreEqual("file.txt file2 file3", q.Search); Assert.AreEqual(">", q.ActionKeyword); }