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

Programmer Mode should support setting the radix based on pasted values #58

Open
MicrosoftIssueBot opened this issue Feb 27, 2019 · 11 comments
Labels
approved Enhancement help wanted Issues identified as good community contribution opportunities Pri: 2

Comments

@MicrosoftIssueBot
Copy link
Collaborator

MicrosoftIssueBot commented Feb 27, 2019

Problem Statement
Calculator currently supports pasting in prefixed/suffixed values in programmer mode if the value is considered valid for the current radix (hex/dec/bin/oct).

Evidence or User Insights
This is a small quality-of-life improvement when using programmer mode.

Proposal
Upon paste in programmer mode, if invalid input is detected, attempt to detect if the value is valid in a radix other than the current one, and if so, automatically switch to that radix and accept pasted value.

Prefixes

  • Pasted input with prefixes always automatically change to specified radix (e.g., "0b" = binary; "0x" = hex, etc.)

Suffixes

  • If pasted input is valid in currently selected radix, prefer to remain in selected radix (e.g., pasting "10b" while in hex results in remaining in hex with "10B").
  • If pasted input is invalid in currently selected radix and is valid in exactly one other radix, automatically change to specified radix (e.g., pasting "10F" in decimal is invalid and is only valid as hex input, so switch to hex).
  • If pasted input is invalid in currently selected radix and is valid in more than one other radix, do not change radix and display "Cannot determine radix" (e.g., pasting "10b" in decimal is invalid, but is valid input for both binary ('b' suffix) and hex ("10B" is valid hex).
  • If pasted input is invalid across radices, maintain current behavior and display "Invalid input".

Goals

  • Minimize instances we display "Invalid Input" by automatically switching radix when we can do so confidently.

Non-Goals

  • Add support for additional radix prefixes/suffixes.

Low-Fidelity Concept
N/A (use existing UI; just switch radix when appropriate)

Requested Assignment
I'm just suggesting this idea. I don't want to implement it.

@MicrosoftIssueBot
Copy link
Collaborator Author

This is your friendly Microsoft Issue Bot. I created this issue automatically as requested by a team member.

@grochocki grochocki added this to New Proposal in Feature Tracking Feb 27, 2019
@grochocki grochocki changed the title Calculator's Programmer Mode should support setting the radix based on pasted values Programmer Mode should support setting the radix based on pasted values Feb 27, 2019
@I-Campbell
Copy link

Can you give a more complete list of accepted prefixes / suffixes / formats? This list should be examined for conflicts, for example would 10d mean "ten decimal" or 0x010D

I feel the mode shouldn't be changed but the number converted, eg pasting 2#011 while in DEC radix should paste as 3, rather than switching to binary.

Should pasting ABC assume HEX radix?
Should pasting 9 assume DEC radix?

@grochocki grochocki added needs more info Issue requires more information from poster and removed Pri: 3 labels Apr 2, 2019
@grochocki grochocki added needs pitch review and removed needs more info Issue requires more information from poster labels Aug 13, 2019
@ghost ghost moved this from Pitch to Pitch (Needs Review) in Feature Tracking Aug 13, 2019
@ghost
Copy link

ghost commented Aug 13, 2019

This pitch looks like it has everything it needs for review. In the meantime, we'll keep this idea open for discussion so the community has the chance to provide feedback. Check out our New Feedback Process for more info on the user-centered process we follow for new feature development.

@grochocki grochocki moved this from Pitch (Needs Review) to Implementation in Feature Tracking Aug 30, 2019
@grochocki
Copy link
Contributor

We reviewed the pitch and would love to move forward with it. Since the idea is fairly straightforward and is entirely captured by the proposal, we can move this straight into production.

@grochocki grochocki added the help wanted Issues identified as good community contribution opportunities label Aug 30, 2019
@grochocki grochocki added the hacktoberfest Hacktoberfest is a month-long celebration of open source software. label Sep 28, 2019
@Tadaboody
Copy link

Going to try this - will post questions here if I run into anything, please reply if this is the right place

@grochocki
Copy link
Contributor

Great! Thanks for picking this up, @Tadaboody.

@Ahmed-Yossef
Copy link

anybody working on this ?

@HowardWolosky
Copy link
Member

anybody working on this ?

@Tadaboody said that they were, but we haven't seen a PR yet. Are you still working on it @Tadaboody?

@Tadaboody
Copy link

Got a bit intimidated after playing around with the code and didn't get around to implementing it - it's open if anyone else wants to tackle it

@grochocki
Copy link
Contributor

Ah, sorry to hear that @Tadaboody. Thanks for taking a look anyway. @Ahmed-Yossef, if you are still interested in trying this one out, it is yours.

@grochocki grochocki removed the hacktoberfest Hacktoberfest is a month-long celebration of open source software. label Nov 12, 2019
@TheBrenny
Copy link

If I knew more about C++ than my small exploration into Arduino, I'd love to help out! But I'm 100% certain I'm going to break something if I try.

Another suggestion to this would be to detect prefixes as they're being typed, as in 0b1101 would automatically switch to decimal as soon as 0b is detected, and if a hex value is recognised beyond the b, automatically switch to hex, as in 0b1101F? Maybe the latter is unnecessary because radix prefixes are pretty common among programmers/binary-users, and as such, it wouldn't occur...

The only exception to the prefix rule would be octal, where 0o (zero and letter O) would be a prefix, rather than just 0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Enhancement help wanted Issues identified as good community contribution opportunities Pri: 2
Projects
Feature Tracking
Implementation
Development

No branches or pull requests

7 participants