Repository navigation
fix(output): align ANSI-coloured cells under --table-style; add lrt script - #85
Merged
Merged
Conversation
Every --table-style except the default renders through comfy-table, which measured cell width in bytes, so ANSI_COLOR output was padded as if the escape codes were visible and the table borders drifted. The default renderer already sized columns by display width. Enable comfy-table's custom_styling feature, which strips escapes when measuring. Tests cover coloured cells in all 13 styles, with and without --max-col-width truncation; 15 of them fail without the feature. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UT2eunuVZv5L2tBTs2zStB
PowerShell function listing the most recently modified files through the FILE CTE: separate date and time columns in local time, a coloured human-readable age, FORMAT_BYTES sizes and names coloured by type. Supports recursion, glob filters, directories and any --table-style. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UT2eunuVZv5L2tBTs2zStB
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.
Summary
Fix: coloured cells misaligned under
--table-style. Every style exceptdefaultrenders through comfy-table, which measured cell width in bytes.ANSI_COLOR('yellow', '3h')was padded as if it were 11 columns wide, so borders and columns drifted. Thedefaultrenderer already used display width.custom_stylingfeature, which strips ANSI escapes when measuring width. No Rust code changes.New:
scripts/lrt.ps1. A PowerShellls -alrtbuilt on the FILE CTE:45s/12m/3h/8d)FORMAT_BYTESsizes and names coloured by file type-r), glob filters (-g), directories (-d) and table style (-style, defaultplain)Tests
tests/python_tests/test_table_output_alignment.py: coloured cells in all 13 table styles, plus four styles with--max-col-widthtruncation. The width checker now ignores ANSI escapes.default-style cases pass, as expected../run_all_tests.shpasses. The one smoke failure,expander_rewriters(a GROUP BY error in query 7), is unrelated to table rendering.Known limitation (not in this PR)
The date functions work in UTC, and there is no function to convert to local time.
lrtshifts by today's UTC offset, so files from the other side of a DST change show an hour out. A follow-up could add a local-time function or an optional time-zone argument toFORMAT_DATE.🤖 Generated with Claude Code
https://claude.ai/code/session_01UT2eunuVZv5L2tBTs2zStB