Skip to content

Handle str() spacing across R versions - #793

Merged
t-kalinowski merged 8 commits into
mainfrom
fix/str-spacing-review
Nov 3, 2026
Merged

t-kalinowski merged 8 commits into
mainfrom
fix/str-spacing-review

Conversation

@t-kalinowski

Copy link
Copy Markdown
Member

Restore separators in S7's str() and print() output after R 4.7 changed which call supplies the leading space. Property values retain their separator, and S7 objects nested in lists avoid doubled spaces. Also fix missing spaces before plain lists, data frames, and classed environments, and extra spaces before inherited data such as logical values and empty lists on older R.

Use a shared helper to print property values and inherited data directly, with an R-version flag cached in .onLoad(). Extend the existing snapshots for logical values and environment properties, and retain the nested-list fixture while normalizing its base-R spacing difference.

Fixes #791.

Alternative to #792.

Replace shared output buffering with version-aware separators, retaining
the fixes for ordinary lists, data frames, environments, and inherited
logical data. Keep one compact regression test and the existing nested-list
snapshot variants; remove capture-specific tests and the benchmark script.
Restore the nested-list snapshot to class.md, normalizing only base R's
version-dependent separator. Replace exact-string assertions with a
snapshot that also checks the complete nested output.
Fold logical-value coverage into the existing display snapshot and handle
classed environment properties while preserving S7 environments' own
legacy separator.
@t-kalinowski
t-kalinowski merged commit 9e1f878 into main Nov 3, 2026
15 checks passed
@t-kalinowski
t-kalinowski deleted the fix/str-spacing-review branch November 3, 2026 16:59
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.

str.S7_object() output is affected by recent R-devel str() change

2 participants