Update default options of builtin hex editor to match external hex editor#416
Update default options of builtin hex editor to match external hex editor#416A2uria wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the built-in hex editor’s default view settings so they align with common external hex editors, improving consistency when comparing/editing byte-level data.
Changes:
- Set the default offset display bit size to 32
- Set the default bytes-per-line to 16
| options.BasePosition = HexPosition.Zero; | ||
| options.UseRelativePositions = false; | ||
| options.OffsetBitSize = 0; | ||
| options.OffsetBitSize = 32; |
There was a problem hiding this comment.
Setting OffsetBitSize to 32 will truncate/wrap displayed offsets for buffers whose logical position exceeds 0xFFFFFFFF. HexOffsetFormatter formats offsets by shifting based on bit size, so a 32-bit setting will repeat offsets every 4GiB and can show incorrect addresses on large files/mappings. Consider keeping OffsetBitSize as 0 (auto) or choosing 32 only when the buffer span fits within 32 bits, falling back to auto/64-bit when it doesn’t.
| options.OffsetBitSize = 32; | |
| options.OffsetBitSize = 0; |
|
Hello, I'm not really a fan of changing the default options like this. I think an argument can be made for both sides (current one vs your proposed default settings). Therefore, I think a better option would be to allow editing these default values inside the dnSpy settings. Do you think this is something you could do as part of this PR? (I know the dnSpy codebase can be quite complex in some places, hence why I am asking:D) If you are not comfortable adding this, we can turn this into a feature request issue. |
Change offset bit size to 32 and bytes per line to 16, so it will match the behaviour of common hex editor / viewer such as 010Editor and xxd, which makes it easier to do things like one byte CIL patch.