mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 22:43:31 +08:00
Merge pull request #58 from cxfksword/master
Fix Calculator & Everything plugin bug
This commit is contained in:
commit
4d299f5b17
@ -16,7 +16,8 @@ namespace Wox.Plugin.Everything
|
|||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
if (query.ActionParameters.Count > 0 && query.ActionParameters[0].Length > 0)
|
if (query.ActionParameters.Count > 0 && query.ActionParameters[0].Length > 0)
|
||||||
{
|
{
|
||||||
IEnumerable<string> enumerable = api.Search(query.ActionParameters[0], 0, 100);
|
var keyword = string.Join(" ", query.ActionParameters.ToArray());
|
||||||
|
IEnumerable<string> enumerable = api.Search(keyword, 0, 100);
|
||||||
foreach (string s in enumerable)
|
foreach (string s in enumerable)
|
||||||
{
|
{
|
||||||
var path = s;
|
var path = s;
|
||||||
|
@ -20,6 +20,7 @@ namespace Wox.Plugin.System
|
|||||||
@"==|~=|&&|\|\||" +
|
@"==|~=|&&|\|\||" +
|
||||||
@"[ei]|[0-9]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
@"[ei]|[0-9]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
||||||
@")+$", RegexOptions.Compiled);
|
@")+$", RegexOptions.Compiled);
|
||||||
|
private static Regex regHasNumber = new Regex(@"[0-9]", RegexOptions.Compiled);
|
||||||
private static Regex regBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled);
|
private static Regex regBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled);
|
||||||
private static ParseContext yampContext = null;
|
private static ParseContext yampContext = null;
|
||||||
private PluginInitContext context { get; set; }
|
private PluginInitContext context { get; set; }
|
||||||
@ -35,6 +36,7 @@ namespace Wox.Plugin.System
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(query.RawQuery)
|
if (string.IsNullOrEmpty(query.RawQuery)
|
||||||
|| query.RawQuery.Length < 2 // don't affect when user only input "e" or "i" keyword
|
|| query.RawQuery.Length < 2 // don't affect when user only input "e" or "i" keyword
|
||||||
|
|| !regHasNumber.IsMatch(query.RawQuery) // must has one number
|
||||||
|| !regValidExpressChar.IsMatch(query.RawQuery)
|
|| !regValidExpressChar.IsMatch(query.RawQuery)
|
||||||
|| !IsBracketComplete(query.RawQuery)) return new List<Result>();
|
|| !IsBracketComplete(query.RawQuery)) return new List<Result>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user