Skip to content

Wrap error title to terminal width#128

Merged
gtsiolis merged 1 commit intomainfrom
george/des-174
Mar 18, 2026
Merged

Wrap error title to terminal width#128
gtsiolis merged 1 commit intomainfrom
george/des-174

Conversation

@gtsiolis
Copy link
Member

This will:

  1. Soft-wrap the error display title so long messages (e.g. license validation failures) wrap at word boundaries instead of being truncated at the terminal edge.
  2. Use rune count instead of byte length for the prefix to get correct indentation on continuation lines
  3. Add test for title wrapping behavior
BEFORE AFTER
Screenshot 2026-03-18 at 10 41 47 Screenshot 2026-03-18 at 10 41 30

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Warning

Rate limit exceeded

@gtsiolis has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 0de26961-8a36-4f66-985d-69f45e293fb0

📥 Commits

Reviewing files that changed from the base of the PR and between 2c3ad73 and d54b02a.

📒 Files selected for processing (2)
  • internal/ui/components/error_display.go
  • internal/ui/components/error_display_test.go
📝 Walkthrough

Walkthrough

The pull request reworks error title rendering in the error display component to support multi-line titles. The implementation adds width-based wrapping logic using UTF-8 rune counting, renders the first wrapped line with a "✗ " prefix, and indents subsequent lines with spaces for alignment. An accompanying test validates that wrapped titles stay within the specified width.

Changes

Cohort / File(s) Summary
Error Display Implementation
internal/ui/components/error_display.go
Refactors error title rendering to support multi-line text. Computes prefix width using utf8.RuneCountInString, wraps title text to fit available width, and renders each wrapped line with appropriate indentation for visual alignment.
Error Display Tests
internal/ui/components/error_display_test.go
Adds TestErrorDisplay_TitleWrapsToWidth test to verify error titles are wrapped correctly to specified width, contain full text, and ensure no line exceeds the given width limit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • carole-lavillonniere
  • silv-io
  • anisaoshafi
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: implementing soft-wrapping for error titles to terminal width, which directly aligns with the primary modification in error_display.go.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the three changes made (soft-wrapping, rune counting, and test additions) with before/after visual comparison.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch george/des-174
📝 Coding Plan
  • Generate coding plan for human review comments

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

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/ui/components/error_display_test.go`:
- Around line 101-106: The width assertion is counting ANSI styling from
styles.ErrorTitle.Render(), making len([]rune(line)) unreliable; update the test
to either strip ANSI escape codes before measuring or test the wrapping logic
directly by calling wrap.SoftWrap (or the equivalent wrapping function) on the
raw unstyled text and assert its widths, and keep
View()/styles.ErrorTitle.Render() assertions limited to content presence; locate
the check in error_display_test.go that iterates over lines and modify it to
remove ANSI sequences (or replace the loop with a call to wrap.SoftWrap on the
unstyled string) before using len([]rune(...)) so the assertion reflects visible
width only.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 8cf9123f-cb60-4fd8-8851-5ababb6e21af

📥 Commits

Reviewing files that changed from the base of the PR and between 8bac894 and 2c3ad73.

📒 Files selected for processing (2)
  • internal/ui/components/error_display.go
  • internal/ui/components/error_display_test.go

@gtsiolis
Copy link
Member Author

Thanks for taking a look, @carole-lavillonniere! 🍿

@gtsiolis gtsiolis merged commit d02f3b3 into main Mar 18, 2026
8 checks passed
@gtsiolis gtsiolis deleted the george/des-174 branch March 18, 2026 09:09
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