mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
dead code, improve messages, group separator fix?
This commit is contained in:
parent
e1079396c3
commit
103d3832a0
2 changed files with 11 additions and 10 deletions
|
|
@ -115,16 +115,15 @@ namespace Flow.Launcher.Plugin.Calculator
|
|||
};
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
// Mages engine can throw various exceptions, for simplicity we catch them all and show a generic message.
|
||||
return new List<Result>
|
||||
{
|
||||
new Result
|
||||
{
|
||||
Title = e.Message,
|
||||
SubTitle = "Calculator Exception",
|
||||
IcoPath = "Images/calculator.png",
|
||||
Score = 300
|
||||
Title = Localize.flowlauncher_plugin_calculator_expression_not_complete(),
|
||||
IcoPath = "Images/calculator.png"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -201,14 +200,19 @@ namespace Flow.Launcher.Plugin.Calculator
|
|||
|
||||
private string GetGroupSeparator(string decimalSeparator)
|
||||
{
|
||||
if (_settings.DecimalSeparator == DecimalSeparator.UseSystemLocale)
|
||||
{
|
||||
return CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator;
|
||||
}
|
||||
|
||||
// This logic is now independent of the system's group separator
|
||||
// to ensure consistent output for unit testing.
|
||||
// to ensure consistent output when a specific separator is chosen.
|
||||
return decimalSeparator == Dot ? Comma : Dot;
|
||||
}
|
||||
|
||||
private bool CanCalculate(Query query)
|
||||
{
|
||||
if (query.Search.Length < 2)
|
||||
if (string.IsNullOrWhiteSpace(query.Search))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@ internal static partial class MainRegexHelper
|
|||
[GeneratedRegex(@"[\(\)\[\]]", RegexOptions.Compiled)]
|
||||
public static partial Regex GetRegBrackets();
|
||||
|
||||
[GeneratedRegex(@"^(ceil|floor|exp|pi|e|max|min|det|abs|log|ln|sqrt|sin|cos|tan|arcsin|arccos|arctan|eigval|eigvec|eig|sum|polar|plot|round|sort|real|zeta|bin2dec|hex2dec|oct2dec|factorial|sign|isprime|isinfty|==|~=|&&|\|\||(?:\<|\>)=?|[ei]|[0-9]|0x[\da-fA-F]+|[\+\%\-\*\/\^\., ""]|[\(\)\|\!\[\]])+$", RegexOptions.Compiled)]
|
||||
public static partial Regex GetRegValidExpressChar();
|
||||
|
||||
[GeneratedRegex(@"-?[\d\.,]+", RegexOptions.Compiled)]
|
||||
public static partial Regex GetNumberRegex();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue