WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
44.81k stars 1.95k forks source link

[Feature] Paste multi bytes without selecting a block #780

Open ArcticLampyrid opened 2 years ago

ArcticLampyrid commented 2 years ago

What feature would you like to see?

In current version, if I want to paste multi bytes, I must to select a block which is large enough to contain it. For a detailed example, if I want to paste 00 01 02, I must select at least three bytes, otherwise I get my pasted data truncated. I'm in favor of a mode that inserts all my pasted bytes without estimating the length and selecting a large-enough block. BTW, a override mode that overrides the following bytes without selecting them is also useful and convenient.

How will this feature be useful to you and others?

It's extremely useful when you get a hex string and firstly paste it into ImHex in aim to analyse it. Such a mode liberats us from estimating the length via a calculator before pasting.

Request Type

WerWolv commented 2 years ago

Hey You don't need to select the exact number of bytes you're trying to paste. When I do the same thing, I usually just create a new file, use Edit -> Resize to resize it to some big number that's certainly large enough for the data, then hit CTRL + A to select all bytes and CTRL + V to paste it. That works fine since it will only overwrite the bytes it needs to

ArcticLampyrid commented 2 years ago

resize it to some big number that's certainly large enough for the data

I just don't think it is the ideal.

WerWolv commented 2 years ago

I generally don't want the underlying data to be changed and/or resized without the user explicitly doing so through the Edit menu. My intention for ImHex is mainly for it to be an analysis tool instead of a file editing tool and in most cases when you're analyzing a file, changing its size will completely break things. That's why it works like it is now. Same thing with having to select the bytes you want to overwrite with a paste. That way you can be sure only the bytes you want to be modified actually do get modified.

ArcticLampyrid commented 2 years ago

How about adding a menu item "Insert Copied Bytes"? Or we can show a message box to let users decide to truncate the data or override the following data (and resize the file if not large enough) They are all explicit.

Arcitec commented 1 year ago

@WerWolv ImHex is an impressive tool, and I really appreciate the advanced analysis tools.

But there's room to be a hex editor too, for an all-in-one solution.

I utterly hate having to click every byte 1 by 1 and editing them manually in the inspector to change values 1 by 1.

Having the ability to "type to replace" is in basically every other Hex editor out there. But ImHex is amazing at analysis, and I keep wishing it could do editing too.

Right now, even basic GNOME's GHex is a better tool because at least it can edit the files. Even though the GUI is super basic.

This could be solved in ImHex with a checkbox: Edit > [x] Replacement Mode. While active, typing on the keyboard or pasting with Ctrl-V in the view will overwrite as many characters as needed.

That way, I would be able to edit strings in files, etc.

Right now I don't see myself using ImHex much. Sure, it provides fantastic analysis, but it can't really edit files. :/ Good for reverse engineering formats and creating parsers, but bad for Hex editing...

Would such a "replacement mode" be possible? Or is the code architecture of ImHex too rigid and not flexible enough to add such a feature?

Edit: I switched to Okteta. It's a good middle-ground between analysis and editing. If ImHex supports editing in the future, I'll re-install ImHex and switch back to it.

WerWolv commented 1 year ago

@Bananaman Hey ImHex does support replacing values the way you describe it. You can double click any byte and then start typing the hex value. As soon as you entered two characters, it automatically advances to the next byte so you can keep typing

Arcitec commented 1 year ago

@WerWolv Oh! That's awesome. I am switching back to ImHex immediaely.

I looked in the manual for that feature, and I did a search on the GitHub issues for it (which is how I found this issue). It seems too hidden in the GUI. Did I miss some obvious place where this is explained? I can't see it mentioned anywhere in the GUI, and couldn't see it in the documentation.

I would have loved to see a "double-click to edit" status tooltip somewhere when hovering over the hex view. Then I wouldn't have thought that ImHex was a bad editor. :D

WerWolv commented 1 year ago

Lol I just assumed it was obvious because other editors work exactly the same

manokara commented 1 year ago

Well, not exactly. UX-wise, in most hex editors you don't have to double-click to enter edit mode, because they're constantly in edit mode. Just clicking once and typing anything is enough, and it works either at the nibble level as if the hex sequence was continuous stream of characters (HxD, GHex, Translhextion) or similar to how ImHex does it by padding a zero if a single digit was given (Okteta), except that in ImHex you have to type the full byte because writing a nibble and moving the cursor to the right cancels edit mode.

ArcticLampyrid commented 1 year ago

because other editors work exactly the same

At least 010editor didn't work so.

github-actions[bot] commented 3 months ago

This issue is marked stale as it has been open for 11 months without activity. Please try the latest ImHex version. (Avaiable here: https://imhex.download/ for release and https://imhex.download/#nightly for development version) If the issue persists on the latest version, please make a comment on this issue again

Without response, this issue will be closed in one month.

ArcticLampyrid commented 3 months ago

I don't think it is stable.

Nemoumbra commented 3 months ago

What do you mean by "stable"? Does it crash?

ArcticLampyrid commented 3 months ago

Sorry, it's a typo. I mean this issue is not stale.