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

Pasting claims "Invalid input" when using common or semi-common alias signs for multiplying and dividing #2114

Open
DandelionSprout opened this issue Jan 27, 2024 · 0 comments

Comments

@DandelionSprout
Copy link

DandelionSprout commented Jan 27, 2024

Describe the bug
Several signs, including very common ones like : and x, are not accepted when being pasted into Calculator, which claims "Invalid input" every time. Additionally, , ÷, and × results in "Invalid input" too, somewhat ironic considering the latter two are used for the buttons within the app.

Steps To Reproduce

  1. Open up Windows Calculator (Close and re-open it if needed), so that the log is empty. Switch between the Standard and Scientific modes between each of the below steps to empty the input box properly.
  2. Paste 80:40 into Calculator and see that the input box shows "Invalid Data".
  3. Paste 80•40 into Calculator and see that the input box shows "Invalid Data".
  4. Paste 80÷40 into Calculator and see that the input box shows "Invalid Data".
  5. Paste 80x40 into Calculator and see that the input box shows "Invalid Data".
  6. Paste 80×40 into Calculator and see that the input box shows "Invalid Data".

Expected behavior
All such aliases, and plausibly additional ones too, are accepted when pasting into Calculator.

Screenshots
I don't think still-images would help showcase this, unfortunately.

Device and Application Information

  • OS Build: 22631
  • Architecture: X64
  • Application Version: 11.2311.0.0
  • Region: nb-NO
  • Dev Version Installed: False

Additional context
I narrowed the "Invalid data" problem to static const wstring c_validBasicCharacterSet = L"0123456789+-.e"; in https://github.com/microsoft/calculator/blob/main/src/CalcViewModel/Common/CopyPasteManager.cpp , and am presuming that it'd be easy to change the values to L"0123456789+-.e:÷•x×"

Creating and binding additional aliases proved difficult despite me trying my hardest to search through the source code. Closest guess I could come up with, was to change a section of https://github.com/microsoft/calculator/blob/main/src/Calculator/Views/GraphingCalculator/GraphingNumPad.xaml.cs from:

            { NumbersAndOperatorsEnum.Divide, Tuple.Create("/", 1, 0) },
            { NumbersAndOperatorsEnum.Multiply, Tuple.Create("*", 1, 0) },

To:

            { NumbersAndOperatorsEnum.Divide, Tuple.Create("/", 1, 0) },
            { NumbersAndOperatorsEnum.Divide, Tuple.Create(":", 1, 0) },
            { NumbersAndOperatorsEnum.Divide, Tuple.Create("÷", 1, 0) },
            { NumbersAndOperatorsEnum.Multiply, Tuple.Create("*", 1, 0) },
            { NumbersAndOperatorsEnum.Multiply, Tuple.Create("•", 1, 0) },
            { NumbersAndOperatorsEnum.Multiply, Tuple.Create("x", 1, 0) },
            { NumbersAndOperatorsEnum.Multiply, Tuple.Create("×", 1, 0) },

Requested Assignment
If possible, I would like to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant