Skip to content

Commit 0406a8d

Browse files
authored
Merge branch 'dev' into Remove-trim-from-query
2 parents e8fba28 + c3d7691 commit 0406a8d

File tree

7 files changed

+163
-104
lines changed

7 files changed

+163
-104
lines changed

.github/workflows/stale.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# For more information, see:
2+
# https://github.com/actions/stale
3+
name: Mark stale issues and pull requests
4+
5+
on:
6+
schedule:
7+
- cron: '30 1 * * *'
8+
9+
jobs:
10+
stale:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/stale@v4
17+
with:
18+
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
19+
days-before-stale: 30
20+
days-before-close: 5
21+
days-before-pr-close: -1
22+
exempt-all-milestones: true
23+
close-issue-message: 'This issue was closed because it has been stale for 5 days with no activity. If you feel this issue still needs attention please feel free to reopen.'

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</ItemGroup>
5454

5555
<ItemGroup>
56-
<PackageReference Include="Droplex" Version="1.4.0" />
56+
<PackageReference Include="Droplex" Version="1.4.1" />
5757
<PackageReference Include="FSharp.Core" Version="5.0.2" />
5858
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.1.3" />
5959
<PackageReference Include="squirrel.windows" Version="1.5.2" />

Flow.Launcher/Themes/Base.xaml

Lines changed: 108 additions & 89 deletions
Large diffs are not rendered by default.

Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Windows;
77
using System.Windows.Controls;
88
using Mages.Core;
9-
using Flow.Launcher.Infrastructure.Storage;
109
using Flow.Launcher.Plugin.Caculator.ViewModels;
1110
using Flow.Launcher.Plugin.Caculator.Views;
1211

@@ -25,6 +24,9 @@ public class Main : IPlugin, IPluginI18n, ISettingProvider
2524
@")+$", RegexOptions.Compiled);
2625
private static readonly Regex RegBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled);
2726
private static Engine MagesEngine;
27+
private const string comma = ",";
28+
private const string dot = ".";
29+
2830
private PluginInitContext Context { get; set; }
2931

3032
private static Settings _settings;
@@ -35,7 +37,7 @@ public void Init(PluginInitContext context)
3537
Context = context;
3638
_settings = context.API.LoadSettingJsonStorage<Settings>();
3739
_viewModel = new SettingsViewModel(_settings);
38-
40+
3941
MagesEngine = new Engine(new Configuration
4042
{
4143
Scope = new Dictionary<string, object>
@@ -54,7 +56,19 @@ public List<Result> Query(Query query)
5456

5557
try
5658
{
57-
var expression = query.Search.Replace(",", ".");
59+
string expression;
60+
61+
switch (_settings.DecimalSeparator)
62+
{
63+
case DecimalSeparator.Comma:
64+
case DecimalSeparator.UseSystemLocale when CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",":
65+
expression = query.Search.Replace(",", ".");
66+
break;
67+
default:
68+
expression = query.Search;
69+
break;
70+
}
71+
5872
var result = MagesEngine.Interpret(expression);
5973

6074
if (result?.ToString() == "NaN")
@@ -76,6 +90,7 @@ public List<Result> Query(Query query)
7690
IcoPath = "Images/calculator.png",
7791
Score = 300,
7892
SubTitle = Context.API.GetTranslation("flowlauncher_plugin_calculator_copy_number_to_clipboard"),
93+
CopyText = newResult,
7994
Action = c =>
8095
{
8196
try
@@ -119,6 +134,10 @@ private bool CanCalculate(Query query)
119134
return false;
120135
}
121136

137+
if ((query.Search.Contains(dot) && GetDecimalSeparator() != dot) ||
138+
(query.Search.Contains(comma) && GetDecimalSeparator() != comma))
139+
return false;
140+
122141
return true;
123142
}
124143

@@ -142,8 +161,8 @@ private string GetDecimalSeparator()
142161
switch (_settings.DecimalSeparator)
143162
{
144163
case DecimalSeparator.UseSystemLocale: return systemDecimalSeperator;
145-
case DecimalSeparator.Dot: return ".";
146-
case DecimalSeparator.Comma: return ",";
164+
case DecimalSeparator.Dot: return dot;
165+
case DecimalSeparator.Comma: return comma;
147166
default: return systemDecimalSeperator;
148167
}
149168
}

Plugins/Flow.Launcher.Plugin.Calculator/Settings.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
1+

72
namespace Flow.Launcher.Plugin.Caculator
83
{
94
public class Settings

Plugins/Flow.Launcher.Plugin.Calculator/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name": "Calculator",
55
"Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)",
66
"Author": "cxfksword",
7-
"Version": "1.1.9",
7+
"Version": "1.1.10",
88
"Language": "csharp",
99
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1010
"ExecuteFileName": "Flow.Launcher.Plugin.Caculator.dll",

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ Dedicated to making your workflow flow more seamless. Search everything from app
5151

5252
### Installation
5353

54-
| [Windows 7+ installer](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest/download/Flow-Launcher-Setup.exe) | [Portable](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest/download/Flow-Launcher-Portable.zip) | `winget install "Flow Launcher"` | `scoop install Flow-Launcher` |
55-
| :----------------------------------------------------------: | :----------------------------------------------------------: | :------------------------------: | :------------------------------: |
54+
| [Windows 7+ installer](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest/download/Flow-Launcher-Setup.exe) | [Portable](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest/download/Flow-Launcher-Portable.zip) |
55+
| :----------------------------------------------------------: | :----------------------------------------------------------: |
56+
57+
| `winget install "Flow Launcher"` | `scoop install Flow-Launcher` | `choco install Flow-Launcher` |
58+
| :------------------------------: | :------------------------------: | :------------------------------: |
5659

5760
> When installing for the first time Windows may raise an issue about security due to code not being signed, if you downloaded from this repo then you are good to continue the set up.
5861

0 commit comments

Comments
 (0)