Skip to content

Commit dae0a5a

Browse files
authored
Merge pull request #1121 from Garulf/Remove-trim-from-query
Pass query without trimming whitespace
2 parents 9bd9b94 + 0406a8d commit dae0a5a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Flow.Launcher.Core/Plugin/QueryBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ public static Query Build(string text, Dictionary<string, PluginPair> nonGlobalP
1616
return null;
1717
}
1818

19-
var rawQuery = string.Join(Query.TermSeparator, terms);
19+
var rawQuery = text;
2020
string actionKeyword, search;
2121
string possibleActionKeyword = terms[0];
2222
string[] searchTerms;
2323

2424
if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPair) && !pluginPair.Metadata.Disabled)
2525
{ // use non global plugin for query
2626
actionKeyword = possibleActionKeyword;
27-
search = terms.Length > 1 ? rawQuery[(actionKeyword.Length + 1)..] : string.Empty;
27+
search = terms.Length > 1 ? rawQuery[(actionKeyword.Length + 1)..].TrimStart() : string.Empty;
2828
searchTerms = terms[1..];
2929
}
3030
else
3131
{ // non action keyword
3232
actionKeyword = string.Empty;
33-
search = rawQuery;
33+
search = rawQuery.TrimStart();
3434
searchTerms = terms;
3535
}
3636

Flow.Launcher.Test/QueryBuilderTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void ExclusivePluginQueryTest()
1717

1818
Query q = QueryBuilder.Build("> file.txt file2 file3", nonGlobalPlugins);
1919

20-
Assert.AreEqual("file.txt file2 file3", q.Search);
20+
Assert.AreEqual("file.txt file2 file3", q.Search);
2121
Assert.AreEqual(">", q.ActionKeyword);
2222
}
2323

@@ -31,7 +31,7 @@ public void ExclusivePluginQueryIgnoreDisabledTest()
3131

3232
Query q = QueryBuilder.Build("> file.txt file2 file3", nonGlobalPlugins);
3333

34-
Assert.AreEqual("> file.txt file2 file3", q.Search);
34+
Assert.AreEqual("> file.txt file2 file3", q.Search);
3535
}
3636

3737
[Test]

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ private async void QueryResults()
573573
if (currentCancellationToken.IsCancellationRequested)
574574
return;
575575

576-
var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins);
576+
var query = QueryBuilder.Build(QueryText, PluginManager.NonGlobalPlugins);
577577

578578
// handle the exclusiveness of plugin using action keyword
579579
RemoveOldQueryResults(query);

0 commit comments

Comments
 (0)