Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PowerToys Run] Inline calculations fail when including parentheses -- utilising operator precedence #18490

Closed
jcphua opened this issue May 26, 2022 · 24 comments
Assignees
Labels
Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Run-Plugin Things that relate with PowerToys Run's plugin interface

Comments

@jcphua
Copy link

jcphua commented May 26, 2022

Description of the new feature / enhancement

I expect operator precedence (use of parentheses) for inline calculations should at the least be supported by PowerToys Run.

Currently when attempting to perform non-complex calculations involving parentheses, the input stops being treated as a calculation.

For comparison, macOS equivalent Spotlight supports parentheses without issue.

Scenario when this would be used?

Useful when trying to perform only slightly more complex calculations using PowerToys Run.

Supporting information

Simple inputs such as:

  • (25+20)
  • (1+2)/3
  • etc.
@jcphua jcphua added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label May 26, 2022
@Jay-o-Way

This comment was marked as resolved.

@jcphua

This comment was marked as resolved.

@davidegiacometti
Copy link
Collaborator

Hi @jcphua
I can repro this.
Calculation with parentheses are supported only if the Calculator plugin is called with the action keyword (default is=).
Not sure if a bug or if by design.

image

@davidegiacometti davidegiacometti added the Product-PowerToys Run Improved app launch PT Run (Win+R) Window label May 26, 2022
@jcphua
Copy link
Author

jcphua commented May 26, 2022

Hi @jcphua I can repro this. Calculation with parentheses are supported only if the Calculator plugin is called with the action keyword (default is=). Not sure if a bug or if by design.

image

Nice. Wasn't aware of the = prefix. Good to know.

My response to this new knowledge, and whether to deem this issue (closed) is whether as per your comment it's a bug or by design-- is PowerToys is targeted for simpletons like me, or for power users (or those attentive enough to have seen any docs mentioning this = calculation prefix)?

@davidegiacometti
Copy link
Collaborator

Default activation commands are documented here: https://docs.microsoft.com/en-us/windows/powertoys/run#direct-activation-commands and can be customized in the plugin manager.
In the Calculator plugin docs parentheses are not mentioned: https://docs.microsoft.com/en-us/windows/powertoys/run#calculator-plugin

Let's keep this opened: I will look at source code and clarify this behavior.

@davidegiacometti davidegiacometti added the Run-Plugin Things that relate with PowerToys Run's plugin interface label May 26, 2022
@davidegiacometti
Copy link
Collaborator

Oh thats pretty simple: ( is the default activation command for Time and Date plugin.
You have to disable the plugin or change the activation command.

image

@jaimecbernardo @crutkas is this something we want to change?
xref #14495

@crutkas
Copy link
Member

crutkas commented May 26, 2022

I think we should change the default key. One issue we do face is period for math as well. I think ( is too math centric so we should tweak that.

Maybe a warning box for “this action command will impact math calculations” for period and (

@crutkas crutkas removed the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label May 26, 2022
@htcfreek
Copy link
Collaborator

@crutkas
What do you suggest as new activation command for the 'Time and Date' pulgin and for the Program plugin?

@crutkas
Copy link
Member

crutkas commented May 29, 2022

Program I think is hard as period is pretty powerful in the context of quickness.

For date time, It could be as easy as shifting to )

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented May 29, 2022

For date time, It could be as easy as shifting to )

Let's not do that 🤣🤣💩

crutkas edited his own quote oops

@crutkas
Copy link
Member

crutkas commented May 29, 2022

Eek. Let edit that

@htcfreek
Copy link
Collaborator

htcfreek commented May 29, 2022

Program I think is hard as period is pretty powerful in the context of quickness.

I looked at the keyboard but there is no other character at this position which we can use. The , is used as thousand/digit separator. What about * or #?

For date time, It could be as easy as shifting to )

Had to look twice to see the difference between the old ( and your suggested ) 😄

@htcfreek
Copy link
Collaborator

htcfreek commented May 30, 2022

Eek. Let edit that

What does "Eek" mean? Don't know this phrase.

@Jay-o-Way
Copy link
Collaborator

Eek. Let edit that

What does "Eek" mean? Don't know this phrase.

The same as "oops".
It's also the name of a silly cartoon.
image

@htcfreek
Copy link
Collaborator

htcfreek commented Jul 21, 2022

@crutkas
As I understand you prefer ) as new activation command for time and date plugin.

Dou you have an idea for program plugin now?

@niels9001
What is needed to add a warning on some activation commands?

@crutkas
Copy link
Member

crutkas commented Jul 22, 2022

I don’t have a massive preference on this. Could be a more complex activation as well such as ‘time’

@htcfreek
Copy link
Collaborator

htcfreek commented Jul 23, 2022

I don’t have a massive preference on this. Could be a more complex activation as well such as ‘time’

@crutkas
What about * for program?

After some investigation we should war on the following character as they break calc on global queries: ., ,, (, +, -

@crutkas
Copy link
Member

crutkas commented Jul 23, 2022

Period was picked cause it was a no-shift key in pretty much all (if not all) keyboard layouts. It also has advantage of being east reach where on US keyboards, asterisk fails both those criteria

@crutkas
Copy link
Member

crutkas commented Jul 23, 2022

Why are we messing with program here? Why don’t we just make the activate “time”?

@Jay-o-Way
Copy link
Collaborator

I think the period is changed in case somebody wants to start a calculation with (e.g.) .5 * pi

@htcfreek
Copy link
Collaborator

Why are we messing with program here? Why don’t we just make the activate “time”?

This comes from you. You suggested to change program plugin.

I think the period is changed in case somebody wants to start a calculation with (e.g.) .5 * pi

And yes this is true.

@crutkas
Copy link
Member

crutkas commented Jul 23, 2022

While valid, That should be done outside this targeted issue and the PR. That is a much larger discussion and thinking point due to two years of muscle memory for everyone and have very few complaints of the scenario.

@htcfreek
Copy link
Collaborator

htcfreek commented Sep 10, 2022

@crutkas
Is this issue fixed or should we keep open for the dot keyword used in program plugin? For me it feels closed. (See 0.62.0 release notes.)

@crutkas crutkas added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Sep 12, 2022
@crutkas
Copy link
Member

crutkas commented Sep 12, 2022

this targeted that since keyword so yes. I do think we should rethink what is on by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Run-Plugin Things that relate with PowerToys Run's plugin interface
Projects
None yet
Development

No branches or pull requests

5 participants