mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
Limit Calculator trigger must has one number at least
make not affect some keyword like "pi"
This commit is contained in:
@@ -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>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user