Skip to content

Write all of show(io, ::GridChunks) to io - #357

Draft
oschulz wants to merge 1 commit into
JuliaIO:mainfrom
oschulz:show-gridchunks
Draft

oschulz wants to merge 1 commit into
JuliaIO:mainfrom
oschulz:show-gridchunks

Conversation

@oschulz

@oschulz oschulz commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

This PR was prepared by Claude (Anthropic) in Claude Code, a Fable 5.2 session at xhigh effort, and cross-reviewed with OpenAI Codex, under the guidance of @oschulz, who will review it before marking it ready.

show(io, ::GridChunks) prints its indentation and commas to stdout instead of io, so they are missing from repr and show up in the terminal:

julia> c = DiskArrays.GridChunks((10, 10), (2, 3));

julia> repr(c)
    
,    
,"GridChunks(\nRegularChunks(2, 0, 10)RegularChunks(3, 0, 10))\n"

With this PR everything is written to io, with one chunk vector per line and no trailing newline:

julia> repr(c)
"GridChunks(\n    RegularChunks(2, 0, 10),\n    RegularChunks(3, 0, 10),\n)"

The text/plain display of a GridChunks is unchanged.

I noticed this while basing the arrays of LegendHDF5IO.jl on DiskArrays.

The indentation and the separating commas were printed to `stdout`
instead of `io`, so `repr` and `sprint` lost them and they leaked into the
terminal. Also drop the trailing newline, which a 2-argument `show` should
not emit.

Assisted-By: generative AI

This branch has not been deployed

No deployments
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.

1 participant