Skip to content

fix(ledmatrix-music): size the progress bar to the text, not the whole panel - #230

Merged
ChuckBuilds merged 3 commits into
mainfrom
fix/music-progress-bar-width
Jul 31, 2026
Merged

fix(ledmatrix-music): size the progress bar to the text, not the whole panel#230
ChuckBuilds merged 3 commits into
mainfrom
fix/music-progress-bar-width

Conversation

@ChuckBuilds

@ChuckBuilds ChuckBuilds commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Problem

The progress bar was drawn at the full width of the text area regardless of how much of that area the text actually filled:

bar_total_width = text_area_width

With a short track title on a wide panel, that leaves a bar stretching right across the display under a few characters. It's especially visible in Vegas scroll mode, where a full-width element reads as sparse.

Trimming can't help here — the bar is ink, so there is nothing blank to reclaim. It has to be drawn narrower in the first place.

Fix

The bar is now sized to the widest of the title, artist and album lines, with a 24px floor so a very short title still leaves something recognisable as a progress indicator.

Three details worth noting:

  • A scrolling line still gets a full-width bar. A line long enough to scroll measures wider than the text area, so it pins the bar to full width — which is correct, because that line genuinely fills it.
  • The album line only counts when it's drawn. On short panels there isn't height for it, and including it would size the bar to text the viewer can't see.
  • Font measurement failure falls back to the full-width bar. Losing the bar entirely would be worse than an over-wide one.

Set progress_bar_match_text to false to restore the previous behaviour.

Testing

The safety harness cannot cover this, which is worth flagging. Its mock track has no duration, so duration_ms > 0 is false and the bar is never drawn — I ran the harness against both the old and new code and the reported extents are byte-identical (256x32 … extent 46%x25% either way). Relying on it here would have given false confidence.

So this ships with focused unit tests in test_progress_bar_width.py (17 cases) that exercise the sizing rule directly: widest-line selection, the floor, the full-area clamp, the scrolling case, hidden album, empty strings, the config toggle, and measurement failure.

  • Safety harness: all sizes PASS.
  • check_module_collisions.py: OK across 41 plugins.

Context

Part of a set of Vegas scroll mode changes. The core-side companion is ChuckBuilds/LEDMatrix#423, which adds the ability to render plugins at a fraction of the panel width so their layouts compact rather than being cropped — this fix handles the one element that narrowing alone can't, since the bar scales to whatever width it's given.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ

Summary by CodeRabbit

  • New Features

    • Music Player progress bars now match the widest visible title, artist, or album line by default.
    • Added an advanced setting to restore full-width progress bars.
    • Scrolling text continues to use the full display width.
  • Documentation

    • Added Music Player version 1.2.0 release notes and updated the catalog.
  • Tests

    • Added coverage for progress-bar sizing, configuration options, bounds, and measurement failures.

…e panel

The progress bar was drawn at the full width of the text area regardless of
how much of that area the text actually filled. With a short track title on a
wide panel that left a bar stretching right across the display under a few
characters. Trimming cannot help here: the bar is ink, so there is nothing to
reclaim — it has to be drawn narrower in the first place.

It is now sized to the widest of the title, artist and album lines, with a
24px floor so a very short title still leaves something recognisable as a
progress indicator. A line long enough to scroll measures wider than the area
and so pins the bar to full width, which is correct — that line really does
fill it. The album line is only counted when there is height to draw it.

Font measurement failures fall back to the full-width bar rather than losing
the bar entirely.

Set progress_bar_match_text false to restore the previous behaviour.

Note the safety harness cannot cover this: its mock track has no duration, so
the bar is never drawn and the rendered extent is byte-identical with and
without the change (verified by running the harness against both). Hence the
focused unit tests in test_progress_bar_width.py, which exercise the sizing
rule directly.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ChuckBuilds, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b97d4eb-3420-4c49-8fb3-0d74523c767a

📥 Commits

Reviewing files that changed from the base of the PR and between fec7999 and 38a4e0e.

📒 Files selected for processing (1)
  • plugins.json
📝 Walkthrough

Walkthrough

The Music Player plugin now sizes its progress bar to visible text by default, preserves full-width behavior through a configuration option, updates version 1.2.0 metadata, and adds focused width-calculation tests.

Changes

Music Player progress-bar sizing

Layer / File(s) Summary
Progress-bar configuration and release contract
plugins/ledmatrix-music/config_schema.json, plugins/ledmatrix-music/manifest.json, plugins/ledmatrix-music/CHANGELOG.md, plugins.json
Adds progress_bar_match_text, updates the plugin to version 1.2.0, and records the release details.
Content-based width calculation
plugins/ledmatrix-music/manager.py
Calculates progress-bar width from measurable title, artist, and album text. The calculation applies minimum and maximum bounds and fallback behavior.
Rendering integration and validation
plugins/ledmatrix-music/manager.py, plugins/ledmatrix-music/test_progress_bar_width.py
Uses the calculated width during display rendering. Tests cover text sizing, bounds, scrolling, hidden lines, configuration, and measurement failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant display as display()
  participant width as _progress_bar_width()
  participant font as Font measurement
  display->>width: pass title, artist, and album lines
  width->>font: measure visible text
  font-->>width: return text widths
  width-->>display: return bounded progress-bar width
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: sizing the progress bar to match the text width.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch fix/music-progress-bar-width
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/music-progress-bar-width

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

codacy-production Bot commented Jul 29, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 27 complexity

Metric Results
Complexity 27

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Replaces Cls.__new__(Cls) with a no-op-__init__ subclass for building the test
shell. The __new__ form is valid Python but Codacy's Pylint reports it as a
missing-cls call; the subclass reads better and states the intent — bypass the
real __init__, which starts polling threads and API clients the sizing logic
does not need.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
@ChuckBuilds

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ChuckBuilds
ChuckBuilds merged commit 44d419a into main Jul 31, 2026
3 of 4 checks passed
@ChuckBuilds
ChuckBuilds deleted the fix/music-progress-bar-width branch July 31, 2026 13:43
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.

2 participants