Skip to content

Fix overlapping and clipped text in LLStatBar layout#287

Merged
RyeMutt merged 1 commit into
developfrom
fix/llstatbar-text-layout
Jun 1, 2026
Merged

Fix overlapping and clipped text in LLStatBar layout#287
RyeMutt merged 1 commit into
developfrom
fix/llstatbar-text-layout

Conversation

@RyeMutt
Copy link
Copy Markdown
Member

@RyeMutt RyeMutt commented Jun 1, 2026

Description

The vertical layout reserved fixed pixel heights (14/15/20px) tuned for a shorter monospace face. With the current taller default font this caused long labels to overprint the right-aligned value, text descenders to spill into the bar/next row, and tick-mark labels to be clipped at the bottom when partially expanded.

Derive the top text reserve and the vertical bottom tick-label reserve from the live monospace line height, reserve the value's width so a long label is ellipsized instead of overlapping, and make the partial-expand required height orientation-aware so vertical bars fit their bottom tick labels.

Related Issues

  • Please link to a relevant GitHub issue for additional context.
    • Bug Fix: Link to an issue that includes reproduction steps and testing guidance.
    • Feature/Enhancement: Link to an issue with a write-up, rationale, and requirements.

Issue Link:


Checklist

Please ensure the following before requesting review:

  • I have provided a clear title and detailed description for this pull request.
  • If useful, I have included media such as screenshots and video to show off my changes.
  • I have tested the changes locally and verified they work as intended.
  • All new and existing tests pass.
  • Code follows the project's style guidelines.
  • Documentation has been updated if needed.
  • Any dependent changes have been merged and published in downstream modules
  • I have reviewed the contributing guidelines.

Additional Notes

The vertical layout reserved fixed pixel heights (14/15/20px) tuned for a shorter monospace face. With the current taller default font this caused long labels to overprint the right-aligned value, text descenders to spill into the bar/next row, and tick-mark labels to be clipped at the bottom when partially expanded.

Derive the top text reserve and the vertical bottom tick-label reserve from the live monospace line height, reserve the value's width so a long label is ellipsized instead of overlapping, and make the partial-expand required height orientation-aware so vertical bars fit their bottom tick labels.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes & Improvements
    • Improved stat bar UI layout to better adapt to different text sizes and font metrics
    • Enhanced label rendering with overflow protection through smart text truncation
    • Refined stat bar tick mark display for better visual consistency

Walkthrough

The PR refactors LLStatBar to compute layout dimensions dynamically from monospace font metrics instead of hardcoded pixel values. Layout constants replace scattered magic numbers, and sizing calculations now adapt to font properties, improving consistency across font sizes.

Changes

LLStatBar Layout and Rendering Refactoring

Layer / File(s) Summary
Layout Constants Foundation
indra/llui/llstatbar.cpp
Introduces STAT_BAR_TEXT_VPAD, STAT_BAR_TICK_LENGTH, and STAT_BAR_MIN_BAR constants to centralize pixel sizing decisions previously hardcoded throughout layout and rendering methods.
Dynamic Layout and Size Computation
indra/llui/llstatbar.cpp
draw() now derives bar_rect bounds from monospace font line height and new constants; getRequiredRect() computes overall height from font-derived text_height for all display configurations (bar shown, history shown, orientation).
Rendering with Updated Layout
indra/llui/llstatbar.cpp
drawLabelAndValue() refactored to render labels with width-limited ellipsizing and right-aligned values based on computed bar dimensions; drawTicks() updated to use STAT_BAR_TICK_LENGTH constant for visual consistency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

📊 Constants now guide the stat bar's dance,
Font metrics replace the pixel trance,
Text and ticks align with grace,
Dynamic layout takes their place! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% 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
Title check ✅ Passed The title 'Fix overlapping and clipped text in LLStatBar layout' directly and clearly describes the main problems being addressed in the changeset.
Description check ✅ Passed The description provides clear context on the problem and solution, but the Related Issues section lacks a proper GitHub issue link, and checklist items remain unchecked without confirmation of completion.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
indra/llui/llstatbar.cpp (1)

400-400: 💤 Low value

Consider naming the horizontal right-side reserve.

This 40 is the right-side space reserved for horizontal tick labels — the same kind of layout magic number the PR centralized into STAT_BAR_* constants. Promoting it (e.g. STAT_BAR_HVALUE_RESERVE) keeps the layout vocabulary consistent. Note the 40 in getRequiredRect() (Line 625) is a minimum total height with different semantics, so keep them separate.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@indra/llui/llstatbar.cpp` at line 400, Replace the magic constant 40 used to
compute bar_rect.mRight in llstatbar.cpp with a clearly named constant (e.g.
STAT_BAR_HVALUE_RESERVE) to match the existing STAT_BAR_* vocabulary; add the
new constant where other STAT_BAR_* constants are defined, then use
STAT_BAR_HVALUE_RESERVE in the calculation for bar_rect.mRight (keeping the
separate 40 in getRequiredRect() unchanged since it has different semantics) and
update any comments to indicate this value is the horizontal right-side reserve
for tick labels referenced by bar_rect.mRight.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@indra/llui/llstatbar.cpp`:
- Line 400: Replace the magic constant 40 used to compute bar_rect.mRight in
llstatbar.cpp with a clearly named constant (e.g. STAT_BAR_HVALUE_RESERVE) to
match the existing STAT_BAR_* vocabulary; add the new constant where other
STAT_BAR_* constants are defined, then use STAT_BAR_HVALUE_RESERVE in the
calculation for bar_rect.mRight (keeping the separate 40 in getRequiredRect()
unchanged since it has different semantics) and update any comments to indicate
this value is the horizontal right-side reserve for tick labels referenced by
bar_rect.mRight.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: efdff3f2-233e-4d68-960c-8e7f40184360

📥 Commits

Reviewing files that changed from the base of the PR and between 0f5d720 and 07f132e.

📒 Files selected for processing (1)
  • indra/llui/llstatbar.cpp

@RyeMutt RyeMutt merged commit 1ea6a7d into develop Jun 1, 2026
15 checks passed
@RyeMutt RyeMutt deleted the fix/llstatbar-text-layout branch June 1, 2026 16:34
@RyeMutt RyeMutt added this to the NEXT milestone Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant