mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #1121 from Garulf/Remove-trim-from-query
Pass query without trimming whitespace
This commit is contained in:
commit
dae0a5a812
3 changed files with 6 additions and 6 deletions
|
|
@ -16,7 +16,7 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rawQuery = string.Join(Query.TermSeparator, terms);
|
var rawQuery = text;
|
||||||
string actionKeyword, search;
|
string actionKeyword, search;
|
||||||
string possibleActionKeyword = terms[0];
|
string possibleActionKeyword = terms[0];
|
||||||
string[] searchTerms;
|
string[] searchTerms;
|
||||||
|
|
@ -24,13 +24,13 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPair) && !pluginPair.Metadata.Disabled)
|
if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPair) && !pluginPair.Metadata.Disabled)
|
||||||
{ // use non global plugin for query
|
{ // use non global plugin for query
|
||||||
actionKeyword = possibleActionKeyword;
|
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..];
|
searchTerms = terms[1..];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // non action keyword
|
{ // non action keyword
|
||||||
actionKeyword = string.Empty;
|
actionKeyword = string.Empty;
|
||||||
search = rawQuery;
|
search = rawQuery.TrimStart();
|
||||||
searchTerms = terms;
|
searchTerms = terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Flow.Launcher.Test
|
||||||
|
|
||||||
Query q = QueryBuilder.Build("> file.txt file2 file3", nonGlobalPlugins);
|
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);
|
Assert.AreEqual(">", q.ActionKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Flow.Launcher.Test
|
||||||
|
|
||||||
Query q = QueryBuilder.Build("> file.txt file2 file3", nonGlobalPlugins);
|
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]
|
[Test]
|
||||||
|
|
|
||||||
|
|
@ -573,7 +573,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
if (currentCancellationToken.IsCancellationRequested)
|
if (currentCancellationToken.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins);
|
var query = QueryBuilder.Build(QueryText, PluginManager.NonGlobalPlugins);
|
||||||
|
|
||||||
// handle the exclusiveness of plugin using action keyword
|
// handle the exclusiveness of plugin using action keyword
|
||||||
RemoveOldQueryResults(query);
|
RemoveOldQueryResults(query);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue