Skip to content

fix: status table alignment and self-update cleanup#4

Merged
X-Zero-L merged 5 commits intomasterfrom
dev
Feb 14, 2026
Merged

fix: status table alignment and self-update cleanup#4
X-Zero-L merged 5 commits intomasterfrom
dev

Conversation

@X-Zero-L
Copy link
Copy Markdown
Owner

@X-Zero-L X-Zero-L commented Feb 14, 2026

Summary

  • Fix status table column alignment with ANSI color codes (pad plain text before applying colors)
  • Align symbol column width with header spacing
  • Adjust title box spacing for CJK terminal rendering

Test plan

  • bash status.sh shows aligned columns
  • Syntax check passes

Summary by Sourcery

Improve the rig status table output formatting for better column alignment and terminal rendering.

Enhancements:

  • Adjust rig status title box spacing to render correctly in CJK and varied terminal widths.
  • Realign status table columns by padding plain text before applying ANSI color codes so colored version/config fields line up across rows.
  • Tweak symbol and column spacing in the status table for more consistent visual alignment.

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.
@cursor
Copy link
Copy Markdown

cursor bot commented Feb 14, 2026

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.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 14, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refines 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 columns

flowchart 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]
Loading

File-Level Changes

Change Details Files
Fix column alignment for version and config fields when using ANSI colors.
  • Introduce plain-text padding for version and config values before applying color escape sequences to avoid width miscalculation in printf.
  • Replace previous version/config display variables with padded, color-wrapped variants used directly in the row printf.
  • Adjust printf format string to consume pre-padded colored fields instead of relying on width specifiers that are confused by ANSI codes.
status.sh
Tweak table layout spacing for header and symbol column for better visual alignment, including CJK terminals.
  • Slightly extend the right-side padding on the "Rig Status" title line to keep box-drawing borders aligned.
  • Insert additional fixed spacing after the status symbol column in the row printf format string to better align symbols with the header.
status.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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>
@X-Zero-L X-Zero-L merged commit feb9c0b into master Feb 14, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant