Conversation
Pad plain text to fixed width before wrapping with color escapes. ANSI escape bytes were counted by printf %-Nb, causing uneven columns.
Pad plain text to fixed width before wrapping with color escapes. ANSI escape bytes were counted by printf %-Nb, causing uneven columns. Match symbol column width (3 spaces after symbol) to header's %-4s.
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 16. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefines the status table’s visual alignment by adjusting header spacing and reworking how colored version/config columns are padded so ANSI escape codes no longer break column widths, including a small tweak to symbol column spacing for better alignment in various terminals (including CJK). Flow diagram for padded colorized version and config columnsflowchart TD
A[Start component row rendering] --> B[Read comp_version and comp_config]
B --> C[Pad comp_version to 18 chars into ver_padded]
C --> D[Pad comp_config to 16 chars into config_padded]
D --> E{Is comp_version equal to N/A?}
E -->|Yes| F[Set ver_padded to DIM + ver_padded + NC]
E -->|No| G[Set ver_padded to WHITE + ver_padded + NC]
F --> H[Colorize config_padded based on comp_config]
G --> H[Colorize config_padded based on comp_config]
H --> I[printf row with sym, name, ver_padded, config_padded and adjusted symbol spacing]
I --> J[End component row rendering]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The padding widths (e.g., 18, 16, 24) are now duplicated magic numbers; consider defining them as named variables/constants near the table header so future adjustments stay consistent and self-documented.
- Since you now pre-pad
comp_versionandcomp_config, revisiting theprintfformat string to remove any redundant spacing and adding a brief comment tying the format specifiers to the header layout would help avoid subtle misalignments later.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The padding widths (e.g., 18, 16, 24) are now duplicated magic numbers; consider defining them as named variables/constants near the table header so future adjustments stay consistent and self-documented.
- Since you now pre-pad `comp_version` and `comp_config`, revisiting the `printf` format string to remove any redundant spacing and adding a brief comment tying the format specifiers to the header layout would help avoid subtle misalignments later.
## Individual Comments
### Comment 1
<location> `status.sh:761-764` </location>
<code_context>
- esac
+ # Pad plain text first, then wrap with colors (ANSI escapes break printf width)
+ local ver_padded config_padded
+ ver_padded=$(printf "%-18s" "$comp_version")
+ config_padded=$(printf "%-16s" "$comp_config")
- # Version display
</code_context>
<issue_to_address>
**suggestion (performance):** Consider using `printf -v` to avoid spawning subshells on each loop iteration.
In a large loop, these assignments spawn two subshells per iteration. You can avoid that by using builtins: `printf -v ver_padded "%-18s" "$comp_version"` and similarly for `config_padded`.
```suggestion
# Pad plain text first, then wrap with colors (ANSI escapes break printf width)
local ver_padded config_padded
printf -v ver_padded "%-18s" "$comp_version"
printf -v config_padded "%-16s" "$comp_config"
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
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
Test plan
bash status.shshows aligned columnsSummary by Sourcery
Improve the rig status table output formatting for better column alignment and terminal rendering.
Enhancements: