Skip to content

fix(tui): fill alt-screen frame with theme panel background - #850

Open
euxaristia wants to merge 2 commits into
Gitlawb:mainfrom
euxaristia:fix/multipass-light-theme-background
Open

fix(tui): fill alt-screen frame with theme panel background#850
euxaristia wants to merge 2 commits into
Gitlawb:mainfrom
euxaristia:fix/multipass-light-theme-background

Conversation

@euxaristia

@euxaristia euxaristia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Blank/cleared cells in the alt-screen frame fell back to the terminal's own default background instead of the theme's panel color, so light themes flashed white on resize or whenever ClearScreen erased the frame
  • Wraps the rendered content in zeroTheme.panel sized to the full frame so every cell is explicitly painted, not just the cells view.BackgroundColor covers

Test plan

  • resize the TUI under a light theme and confirm no white flash
  • confirm dark themes are unaffected

Summary by CodeRabbit

  • Bug Fixes
    • Improved alternate-screen rendering by applying the configured theme background consistently across the full terminal area.
    • Blank spaces and cleared screen regions now display the correct panel surface color.

Blank and cleared cells fell back to the terminal's own default
background instead of the theme's panel color, flashing white on
light themes during resize or when ClearScreen erases the frame.
Wrap the rendered content in zeroTheme.panel sized to the full frame
so every cell is explicitly painted.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 59 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 10fd9c8e-c913-4a67-bf28-078880eb9913

📥 Commits

Reviewing files that changed from the base of the PR and between 8e26679 and 62e3f31.

📒 Files selected for processing (1)
  • internal/tui/model.go

Walkthrough

Alt-screen rendering wraps view content in a full-size theme panel at the current terminal dimensions. Blank and cleared regions use the configured theme background.

Changes

Alt-screen rendering

Layer / File(s) Summary
Theme panel rendering
internal/tui/model.go
Alt-screen views render through a full-size theme-panel wrapper and set view.BackgroundColor for blank and cleared cells.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 TUI change that fills the alt-screen frame with the theme panel background.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/tui/model.go`:
- Around line 2774-2776: After applying the panel in the model view-rendering
flow, update the existing tea.View instance by calling view.SetContent(content).
Do this within the width and height condition after zeroTheme.panel renders the
content, ensuring tea.View.Content reflects the themed panel output rather than
the original string.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 98e2fd70-7bb7-4ffb-8885-04b6ca0fa51b

📥 Commits

Reviewing files that changed from the base of the PR and between 8e26679 and 2f38492.

📒 Files selected for processing (1)
  • internal/tui/model.go

Comment thread internal/tui/model.go
tea.NewView stores the original string; reassigning the local content
variable left the view unchanged. Call SetContent after the panel
render so the alt-screen frame uses the themed output.
@euxaristia

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit finding in 62e3f31:

  • After the theme panel re-renders content, call view.SetContent(content) so tea.View returns the themed alt-screen frame instead of the pre-panel string from tea.NewView.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

@euxaristia I will perform a complete review of PR #850, including the update in 62e3f31.

✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 59 minutes.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. The diagnosis matches what I see: view.BackgroundColor only paints the cells the view actually covers, so blank and padding cells — and anything ClearScreen erases — fell through to the terminal default, which is white on a light terminal. Wrapping the content in the theme panel at full frame size paints every cell, which is the right fix.

I did check the thing that worries me about wrapping already-laid-out content, since the TUI does its own wrapping and a second pass could corrupt the layout. Rendering through zeroTheme.panel.Width(40).Height(10):

short                lines 1->10   widest 2->40
exact width lines    lines 5->10   widest 40->40
more lines than h    lines 16->17  widest 1->40
over-wide line       lines 1->10   widest 55->40

The two cases I was worried about are both fine. Content taller than the frame is not truncated (16 lines stayed 16, not clipped to 10), so nothing gets hidden on a full screen. And lines that are already exactly the frame width are not re-wrapped, so the normal path is untouched.

One behaviour change worth naming, not blocking: a line wider than the frame now wraps where it previously ran off and was clipped by the terminal. That is arguably better, but it is a change — if anything in the TUI deliberately emits a line wider than m.width expecting the terminal to clip it, that content will now reflow and push everything below it down by a line. I could not find a case that does, so I am not asking you to change it; just worth knowing which behaviour you are choosing if a layout oddity shows up later on a narrow terminal.

The m.width > 0 && m.height > 0 guard is the right call too — rendering at zero size before the first WindowSizeMsg would be the obvious way to break this.

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