Conversation
Add a MaxCellWidth constant (50 chars) to Formatting module and apply it in formatTable. Cell values longer than 50 characters are clipped and '...' appended, preventing a single long string from making an entire column unreadably wide. Column widths are now computed from clipped values, so the padding remains tight. Short values are unaffected. The 50-char limit is consistent with the pandas default and with the limit suggested in #570. Tests: added 3 new formatting tests (long series values, long frame values, short values not truncated). All 615 tests pass. Co-authored-by: Copilot <[email protected]>
9 tasks
…ation-570-f50f7487ddaa1a90
dsyme
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Repo Assist — implementing feature requested by
@dsymein #570.Summary
Closes #570. When a series or frame is printed in FSI (or via
.Format()/.ToString()), cell values longer than 50 characters are now truncated with"...", preventing a single long string from making an entire column unreadably wide.Root Cause / Motivation
The existing
formatTablealready does per-columnPadRightalignment, but it used the raw (uncapped) cell lengths to compute column widths. A single value of length 200 would make the whole column 201 characters wide, completely destroying readability. This was reported in #570 with a working proof-of-concept.Fix
Added two changes to
Formattingmodule insrc/Deedle/Common/Common.fs:MaxCellWidth = 50— new configurable constant (consistent with the suggestion in Make fsi print more beautiful #570 and pandas' default display width).truncateCell— private helper that clips strings exceedingMaxCellWidthand appends"...".formatTable— builds aclipped2D array before computing column widths and padding, so alignment is computed on the capped values.The change is surgical — only
formatTableis touched.FormatStringsand the rest of the pipeline are unchanged.Trade-offs
MaxCellWidthcan be made mutable (likeRowStartItemCount) in a follow-up.Test Status
✅ All 615 tests pass on Linux (
dotnet test tests/Deedle.Tests/Deedle.Tests.fsproj -c Release).3 new formatting tests added:
series with long string values truncates at MaxCellWidthframe with long string values truncates at MaxCellWidthseries short values are not truncated