calculator icon indicating copy to clipboard operation
calculator copied to clipboard

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

Open DandelionSprout opened this issue 1 year ago • 0 comments

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.

DandelionSprout avatar Jan 27 '24 17:01 DandelionSprout