microsoft / calculator

Windows Calculator: A simple yet powerful calculator that ships with Windows
MIT License
29.5k stars 5.34k forks source link

Copy values from Hex mode without spaces #1331

Open etra0 opened 4 years ago

etra0 commented 4 years ago

Problem Statement

When you copy values from the Hex mode in the Programmer's calculator, you copy the values with the spaces included. In most programming languages, hex numbers do not support spaces in between, so you have to manually remove them every time you paste that number in a text editor.

Evidence or User Insights

Popular programming languages don't support spaces in between, for example: C, C++, Python, Rust, etc.

Proposal

When you're copying from the hex calculator, copy the values without spaces.

Goals

User can copy the result values from the calculator without the spaces every word.

Non-Goals

Don't remove the space in the display, they help when reading the value.

Requested Assignment

If the idea is approved, I would like to try to implement this on a time frame, if I can't, I will inform it so a maintainer can take care of the idea.

MicrosoftIssueBot commented 4 years ago

This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it.

ghost commented 4 years ago

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 commented 4 years ago

We reviewed the pitch and would love to move forward with it. There are likely other places where we can be better about removing "display characters" (whitespace, list separators, etc.), but this is a nice quality of life improvement that we should take right away. Since the idea is fairly straightforward and is entirely captured by the pitch, we can move this straight into production.

@etra0 let us know if you plan to tackle this one or if we should open it up to the community

mcooley commented 4 years ago

@grochocki Are comma separators a "display character" which we should remove, or are those special? See discussion in #1305.

grochocki commented 4 years ago

Hmmm... good point made in #1305. Ultimately, what should we be optimizing for? Do we have to pick? I am curious if we could set multiple data formats when copying. If we set text and RTF, for example, what is the default paste behavior in applications like Word/Outlook vs. VSCode and does that get us close enough to optimizing for common scenarios?

Also, we are currently inconsistent:

etra0 commented 4 years ago

@grochocki I'd love to tackle this feature as a first contribution to an open source project for me (if that's not an issue). I'm thinking of giving myself a timeframe of a month to see if I can implement it and in the case I don't, I would let you guys know to give the feature request to the community.

I agree we should discuss the case for the general display characters as well.

grochocki commented 4 years ago

Sounds good, @etra0! Let us know if you run into any trouble.

achmurali commented 3 years ago

Hi @grochocki, is this issue fixed?

grochocki commented 3 years ago

Not yet - feel free to take a look at this one, if you are interested in implementing this.

ferib commented 2 years ago

Any progress? every time I copy-paste a hex value from the calculator and see the stupid space I feel the urge to come here and make an issue about it, but it only takes a split second to remove the space and move on with my life.

After months of doing this, I figured I could have spent the time fixing the problem myself. Is there any progress made @grochocki or should I start myself?

ferib commented 2 years ago

After looking into the source code I figured this issue was fixed but in a different way: image

The value copied to the clipboard will be passed through RemoveGroupSeperators, however, this is only the case when you right-click the small value or use the ctrl+C keyboard shortcut. In other words, selecting the characters and copying those will still contain a seperator/whitespace.

tacosontitan commented 2 years ago

I'm looking into this where @ferib left off; it sounds like the manual copypasta process is still experiencing issues. @ferib do you have any recommendations on areas of interest you might have had?

ferib commented 2 years ago

I'm looking into this where @ferib left off; it sounds like the manual copypasta process is still experiencing issues. @ferib do you have any recommendations on areas of interest you might have had?

As you can see from my previous post there happened to be a method to get the raw display values the whole time. From my experience there are 3 ways to copy-paste the values:

The one method that is unchecked won't remove any unwanted operators, I have had a rough look at the code and was only able to identify the 2 other ways of copy-pasting the value.

If you manage to find a way to 'hook' into copying the selected text, have it pass through the RemoveGroupSeperators function and see if that works.

erinrshi commented 2 years ago

hi, i was looking into this issue in CopyPasteManager.cpp, and thought the fix would be in CopyToClipboard(), since I understand it to write to computer memory, would this be the wrong place to look? It seems whenever I test w copy, nothing in the file gets triggered?