-
Notifications
You must be signed in to change notification settings - Fork 85
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
Copy HEX values to other programs #341
Comments
The copied value is the base64 representation of the bytes |
Is it possible to change it so that you can copy and paste the hex values as text to and from the editor window? That would be very helpful. |
Hi! I was reading the code to find a way to solve this issue, but there's something I don't understand. --- a/media/editor/copyPaste.tsx
+++ b/media/editor/copyPaste.tsx
const decode: { [key in Encoding]: (data: string) => Uint8Array } = {
- [Encoding.Base64]: d => base64.toUint8Array(d),
+ [Encoding.Base64]: d => Uint8Array.from(d.split(" ").map((byte) => parseInt(byte, 16))),
[Encoding.Utf8]: d => new TextEncoder().encode(d),
}; --- a/src/hexEditorProvider.ts
+++ b/src/hexEditorProvider.ts
const parts = await Promise.all(message.selections.sort((a, b) => a[0] - b[0]).map(s => document.readBuffer(s[0], s[1] - s[0])));
const flatParts = flattenBuffers(parts);
- const encoded = message.asText ? new TextDecoder().decode(flatParts) : base64.fromUint8Array(flatParts);
+ const encoded = message.asText ? new TextDecoder().decode(flatParts) : Array.from(flatParts).map(byte => byte.toString(16).padStart(2, "0")).join(" ");
vscode.env.clipboard.writeText(encoded); What am I missing? |
I believe we went with base64 due to the hex editor being tightly coupled with debugging in certain scenarios. |
Another request for an option to not use Base64. It makes no sense for most use cases. If I copied I'm sure that some situations would require that, and I think it's fine to treat it that way on the backend, but when a user copies the result should be to user desirable data. |
Absolutely.
What is selected is what should be copied.
If the destination clipboard is text, the format should match as close as
possible to how it looked at the source.
If I select some text in an email, I don’t expect to get a base64 encoded
representation of the utf8 either.
…On Fri, 11 Aug 2023 at 01:05, jnz86 ***@***.***> wrote:
Another request for an option to not use Base64. It makes no sense for
most use cases. If I copied AA BB CC I need that. I almost will never
need qrvM.
I'm sure that some situations would require that, and I think it's fine to
treat it that way on the backend, but when a user copies the result should
be to user desirable data.
—
Reply to this email directly, view it on GitHub
<#341 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAKRZAPWSCY3SVPN5BH5GDXUUBERANCNFSM5OZPOGOQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This is a huge problem when debugging C++... I can't think of a single time where I wanted to copy base64 from memory instead of hex.. |
Any update on this? I've had to use a 3rd-party website (hexed.it) to copy byte values. |
bad extension. I found an extension: https://marketplace.visualstudio.com/items?itemName=slevesque.vscode-hexdump You should install it by "Install from VSIX". |
Manually constructing a PEM file from a DER file is my only use case so far (I agree that a hex encoded copy is usually more useful). |
Any plans on implementing this? |
It's already been implemented but the mainteiners are probably busy right now, that's why they haven't release a version with the patch yet |
|
I just recently noticed that I cannot copy the HEX value "as shown" to other editors. For example when I copy the following content
I get the following text, which is neither the HEX value nor the text after UTF encoding.
//79/1AATgBHAA0ACgANAAoAGgANAAoAAAAAAAAADQAKAEkASABEAFIAAAAAAAcA/f8AAAAABAD9/wgABgAAAAAAAAD9/yQAfgQAAAAAAAABAHMAUgBHAEIAAAD9//3/HAD9/wAAAAAAAAQAcwBCAA==
The text was updated successfully, but these errors were encountered: