-
Notifications
You must be signed in to change notification settings - Fork 115
Fix line wrapping issue with colorized table output #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where ANSI color codes in table cells are not properly preserved when text wraps across multiple lines, causing broken colorization and incorrect width calculations.
Changes:
- Added
wrapPreColorized()method to handle color-aware text wrapping - Modified table row rendering to use the new wrapping function for pre-colorized content
- Added comprehensive test coverage for wrapped colorized table cells
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/cli/Colors.php | Adds getResetCode() and wrapPreColorized() methods to preserve ANSI color codes across wrapped lines |
| lib/cli/table/Ascii.php | Updates row rendering logic to use color-aware wrapping for pre-colorized content |
| tests/Test_Table_Ascii.php | Adds test case verifying that colorized text maintains color codes when wrapped |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Remove strict string comparison ($matches[1] !== '0') in favor of consistent regex check - Add documentation about limitation: only tracks most recent ANSI code, not layered formatting - Simplify logic by treating all ANSI codes (except ESC[0m) as potential active colors Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.