Skip to content

Update default options of builtin hex editor to match external hex editor#416

Open
A2uria wants to merge 1 commit intodnSpyEx:masterfrom
A2uria:master
Open

Update default options of builtin hex editor to match external hex editor#416
A2uria wants to merge 1 commit intodnSpyEx:masterfrom
A2uria:master

Conversation

@A2uria
Copy link
Copy Markdown

@A2uria A2uria commented Feb 27, 2025

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.

Copilot AI review requested due to automatic review settings April 7, 2026 06:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
options.OffsetBitSize = 32;
options.OffsetBitSize = 0;

Copilot uses AI. Check for mistakes.
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

Successfully merging this pull request may close these issues.

2 participants