feat: add number formatting options for display (#197)#203
Open
wellorbetter wants to merge 1 commit intoYS-L:mainfrom
Open
feat: add number formatting options for display (#197)#203wellorbetter wants to merge 1 commit intoYS-L:mainfrom
wellorbetter wants to merge 1 commit intoYS-L:mainfrom
Conversation
wellorbetter
commented
Apr 6, 2026
Author
wellorbetter
left a comment
There was a problem hiding this comment.
Implements number formatting for display rendering (issue #197).
New module src/format.rs provides four formats — thousands, fixed, si, scientific —with an optional --precision N parameter. Formatting is applied at the render layer only
(src/ui.rs), so search/sort/copy continue to use original values.
Changes:
src/format.rs: core formatting logic + 40 unit testssrc/runner.rs: three new CLI args (--number-format,--column-format,--precision)src/app.rs: pass config asArc<ColumnFormatConfig>to render state each framesrc/ui.rs: apply format inrender_rowandget_column_widthsfor correct column sizingsrc/lib.rs: exposepub mod format
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.
Description
Add number formatting options for display rendering.
Closes #197
Reasoning
CSV files often contain raw numeric data that is hard to read at a glance (e.g.
23.505744680851063,1234567,2500000000).This change adds display-layer formatting so numbers can be rendered in a more human-readable form without affecting the
underlying data — search, sort, and copy all continue to use original values.
Four formats are supported:
thousands--number-format thousands1234567.891,234,567.89fixed--number-format fixed23.50574468085106323.51si--number-format si25000000002.50Bscientific--number-format scientific0.001231.23e-3Non-numeric values (dates, strings, empty cells) are passed through unchanged.
An optional
--precision Nparameter controls decimal places forfixed,si, andscientificformats (default: 2).Usage
Testing
cargo test— 40 new unit tests insrc/format.rs, all passingexamples/test_format.csvwith each format and verify display:date) render unchanged--no-headers+--column-formatprints a warningType of change