diff --git a/Flow.Launcher.Core/Plugin/QueryBuilder.cs b/Flow.Launcher.Core/Plugin/QueryBuilder.cs index ef387b693eb..a819f94b7b0 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; @@ -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; } diff --git a/Flow.Launcher.Test/QueryBuilderTest.cs b/Flow.Launcher.Test/QueryBuilderTest.cs index 6090ecc65ea..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); } @@ -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] 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);