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 from clipboard on a new and empty session crashes. (+ smart paste?) #42

Open
CosminPerRam opened this issue Feb 19, 2023 · 8 comments

Comments

@CosminPerRam
Copy link

Regarding the crash:
Let's say that I have this in my clipboard (as a string): 20 00 62 75 69 6C, I open Hexerator (a new session) and i go Edit > Paste at cursor > Hex text from clipboard then boom, panic:
image
As I often inspect hex from my clipboard (as I get it as output from my program) I would like to be able to directly paste it on a new session to inspect it.

Regarding 'smart paste':
Doing println!("{:02X?}", data); (where data is an Vec<u8> for example, it outputs in the console this string: [20, 00, 62, 75, 69, 6C], and I want to copy and paste it in the program (let's say without the ending square brackets (so my clipboard now is 20, 00, 62, 75, 69, 6C), i get this error:
image
... which is understandable as the string contains commas, but annoying as I have to get rid of all my commas to paste it in. Which is also a bit annoying as I apparently can't just CTRL + V to paste it.

@crumblingstatue
Copy link
Owner

Thank you for the report. I'll try to think about how to best support pasting data into an empty document, and support multiple formats to parse binary data from text.

@crumblingstatue
Copy link
Owner

Since Hexerator mainly deals with binary files, for which fixed length can be important, I don't want to silently expand the size of the binary file if the paste exceeds it.
What I'm thinking of is displaying a message box that the paste exceeds the size, and ask the user whether they want to expand the file or not to continue with the paste.

However trying to implement this, I ran into some architectural problems with the UI of hexerator. I'll have to think about how to solve those problems before I can implement this in a satisfactory manner. Sorry in advance for the wait.

@CosminPerRam
Copy link
Author

CosminPerRam commented Feb 20, 2023

What I'm thinking of is displaying a message box that the paste exceeds the size, and ask the user whether they want to expand the file or not to continue with the paste.

Sounds nice, I think of this as being a setting (lets call it "do not exceed original size when pasting data" for example) that defaults to true.

Sorry in advance for the wait.

Absolutely no problem, thanks for considering it and sorry that I'm not able to help (skill issue).
Godspeed.

@crumblingstatue
Copy link
Owner

Working on the UI side of things
image

@CosminPerRam
Copy link
Author

Heyo, any updates?

@crumblingstatue
Copy link
Owner

Sorry, I've been not in the mood to do programming in the past few weeks.
I'll try to do something about this in the next few days, but no promises.

@CosminPerRam
Copy link
Author

No problem, it's understandable, take your time!

@crumblingstatue
Copy link
Owner

The current situation is, you can paste now (on git main branch) without panicking. You can choose the "Extend document" option.
image
Then you can right click on the hex view and choose "Region properties"
image
Then you can click the "Reset" button on the region to reset it to the new size.
image

I haven't yet determined how to do this automatically, because Hexerator views are flexible by default, so I don't want to accidentally overwrite a custom region without the user's consent.

Probably the way to go would be to properly establish the concept of "default" views/regions, which can be subject to automatic changes.

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

2 participants