feat(format): visualize tab characters in table output#573
Conversation
…ap ExpandTabFunc Replace tab characters with visible arrow (→) plus padding spaces in table output, using go-tabwrap v0.1.2's ExpandTabFunc for correct tab-stop column tracking. This makes tabs visible and preserves alignment. - Add tab_visualize.go with visualizeTab and visualizeTabsInRow - Integrate tab visualization in TableStreamingFormatter.writeRowInternal - Add comprehensive tests for tab visualization - Upgrade go-tabwrap v0.1.1 → v0.1.2 Fixes #568 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the table output formatting by introducing a feature to visually represent tab characters within table cells. This change significantly improves the readability and debugging experience for users by making implicit tab expansions explicit, while maintaining correct column alignment and supporting both styled and unstyled output modes. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Code Metrics Report📊 View detailed coverage report (available for 7 days)
Details | | main (3c3afb0) | #573 (ac3f387) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 70.5% | 70.7% | +0.1% |
| Files | 74 | 75 | +1 |
| Lines | 6944 | 6988 | +44 |
+ | Covered | 4902 | 4945 | +43 |
+ | Code to Test Ratio | 1:1.2 | 1:1.2 | +0.0 |
| Code | 16154 | 16241 | +87 |
+ | Test | 20820 | 21086 | +266 |
+ | Test Execution Time | 1m14s | 1m11s | -3s |Code coverage of files in pull request scope (78.3% → 85.0%)
Reported by octocov |
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature to visualize tab characters in table output, enhancing readability for users. The implementation correctly leverages the go-tabwrap library for accurate tab stop calculations and provides both styled and unstyled output options. The new tests are comprehensive and cover various scenarios, including CJK characters and newline handling, ensuring the robustness of the tab visualization logic. The update to go-tabwrap to v0.1.2 is appropriate for accessing the necessary ExpandTabFunc API. A high-severity issue was identified regarding the loss of dimming style for visualized tab characters during text wrapping, which needs to be addressed to maintain consistent styling.
…in WithText Rename visualizedCell to tabVisualizedCell for clarity since the type is specific to tab visualization. Fix WithText to return a tabVisualizedCell that re-applies dim styling to arrow characters and preserves cellStyle, so wrapped segments maintain consistent tab visualization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request introduces a new feature to visualize tab characters in table output, which is a valuable enhancement for readability. The implementation correctly leverages the go-tabwrap library and provides comprehensive test coverage for various scenarios, including CJK characters and width preservation. The integration into the TableStreamingFormatter as a preprocessing step before wrapping ensures that the tab visualization works seamlessly with existing layout logic. The changes to go.mod and go.sum correctly reflect the dependency update.
Store only the styled string in tabVisualizedCell and lazily derive the plain version via stripANSI on first RawText() call. This reduces ExpandTabFunc to a single call per cell and eliminates the plain field from initialization. Move stripANSI from test to production code, change visualizeTab to accept a styled bool parameter, and switch tabVisualizedCell to pointer receivers for mutable caching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature to visualize tab characters in table output, enhancing readability and debugging for users. The implementation is well-structured, separating the tab visualization logic into a new tab_visualize.go file. The approach of using go-tabwrap for accurate column tracking and handling both styled and plain output is robust. Comprehensive tests cover various scenarios, including CJK widths and newline resets, ensuring the correctness and reliability of the new functionality. The dependency update for go-tabwrap is appropriate for leveraging the new ExpandTabFunc API. Overall, this is a solid and well-executed feature.
|
/gemini summary |
Summary of ChangesThis pull request introduces a significant enhancement to table output formatting by making tab characters explicitly visible. It replaces tabs with a → symbol and appropriate spacing, ensuring correct column alignment and readability. The feature is seamlessly integrated into the table rendering pipeline, supporting both styled and plain text outputs, and is backed by a dependency upgrade and thorough testing. Highlights
Changelog
Activity
|
Summary
→) plus padding spaces to the next tab stop, using go-tabwrap v0.1.2'sExpandTabFuncfor accurate column tracking\033[2m→\033[22m); in plain mode, a plain→is usedwriteRowInternal, before wrapping — tabs become regular characters so wrap works normallyDetails
tab_visualize.gowithvisualizeTab(delegates toCondition.ExpandTabFunc) andvisualizeTabsInRow(per-cell preprocessing respectingStyledconfig)visualizedCelltype that carries both plain (for width calculation) and styled (for display) representationsgo-tabwrapv0.1.1 → v0.1.2 for the newExpandTabFuncAPITest plan
make checkpasses (test + lint + fmt-check)TestVisualizeTabcovers tab-stop positions, CJK, newlines, multiple tabsTestVisualizeTab_WidthPreservedverifies display width matches original tab expansionTestVisualizeTabsInRow_*tests styled/unstyled cell handlingTestWriteTable_WithTabsvalidates end-to-end table renderingFixes #568