Skip to content

fix: keep position column aligned for large offsets (fixes #228) - #278

Closed
wyf027 wants to merge 1 commit into
sharkdp:masterfrom
wyf027:fix/large-offset-alignment-228
Closed

fix: keep position column aligned for large offsets (fixes #228)#278
wyf027 wants to merge 1 commit into
sharkdp:masterfrom
wyf027:fix/large-offset-alignment-228

Conversation

@wyf027

@wyf027 wyf027 commented May 26, 2026

Copy link
Copy Markdown

Summary

  • Dynamically sizes the position column (and matching border width) based on the maximum offset displayed in the dump.
  • Fixes misalignment when --display-offset or --skip produce offsets beyond 32-bit range (e.g. 0x10000002f0).
  • Pads squeeze markers (*) to the same width so squeezed rows stay aligned.

Fixes #228.

Test plan

  • cargo test display_offset
  • Added large_display_offset_keeps_columns_aligned unit test
  • Existing unit and integration tests still pass (color integration tests remain pre-existing env failures)

Dynamically size the position field and border based on the maximum
displayed offset. Fixes #228.

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f41f07ed41

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs
Comment on lines +756 to +757
let mut content = Vec::new();
reader.read_to_end(&mut content)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore streaming reads in normal print mode

In IncludeMode::Off, print_all now buffers the entire input with read_to_end before printing, which changes behavior from streaming to full preloading. This can cause unbounded memory growth (or OOM) on large files and makes piped/long-running stdin sources produce no output until EOF, which is a functional regression from the previous chunked BufReader loop.

Useful? React with 👍 / 👎.

@wyf027 wyf027 closed this by deleting the head repository Jun 23, 2026
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.

Positions >2^32 cause output to be misaligned

1 participant