Repository navigation
fix(tui): repair light/dark theme switching artifacts - #196
Conversation
- Keep structural containers (pickerBox, inputBoxStyle) transparent: nested styled spans emit ANSI resets that punch through inherited parent backgrounds, causing gray/black cutout blocks - Force full repaint (tea.ClearScreen) on theme-picker navigation and Escape-cancel so stale cells from the previous polarity cannot linger - Replace background regression tests: containers must be transparent, leaf surfaces (status bar, metrics) stay solid - Add dark-to-light-to-dark preview transition test asserting repaint
QualityMax ReviewVerdict: COMMENT · Confidence: evidence-backed scan Files eligible: 4 · Files reviewed: 4 · Files with findings: 0 · Findings: 0 · Inline cards: 0 Priority findings
Review gates
Important files
Change diagram — Flowgraph TD
Input[User Input: Up/Down/Esc] --> Check{Polarity Changed?}
Check -- Yes --> Clear[Return tea.ClearScreen]
Check -- No --> Update[ApplyTheme Only]
Clear --> Render[Repaint Screen]
Update --> Render
Review lifecycleUse the inline cards to inspect evidence and suggested remediation. Re-run the QualityMax review after pushing a fix; unchanged cards are identified by their stable finding marker. Dismiss with a reason through the existing QualityMax/GitHub review feedback flow. 0 prior card(s) are stale/resolved on this head. Proof legend: VERIFIED independently judged patch · REPRODUCED verified finding · GROUNDED deterministic evidence · MODEL-ONLY model judgment. QualityMax project results are available in the configured project. Receipt · commit |
|
| Gate | Result |
|---|---|
| 🔍 AI diff review | ✅ Clean · gemini-3.1-flash-lite · completed · 4 eligible / 4 reviewed · gemini-3.1-flash-lite |
| 🔍 SAST | completed · 4 eligible / 4 reviewed · qwen3.7-plus |
| 🔍 Canonical PR review delivery | completed · 0 eligible / 0 reviewed · exact-head review #5186325719 and overview #5645483524 confirmed |
| 🧪 Repo Tests | ✅ 802/802 passed (go) |
Powered by QualityMax — AI-Powered Test Automation
Adversarial-review follow-ups: - Foreground-only picker chrome (labels, headers, footers, dividers, hints) now keys off the terminal's actual background polarity instead of the previewed theme's. Previewing a light theme on a dark terminal (or vice versa) previously rendered near-black labels on a dark background — the exact invisible-text bug #195 tried to fix. Values match same-polarity themes exactly, so matched setups are unchanged. - Gate tea.ClearScreen on actual polarity flips: clearing erases the visible screenful in place, so every arrow key was destroying the on-screen transcript. Same-polarity moves rely on the renderer's line diff; cancel only clears when the restore flips polarity. - Skip glamour renderer rebuilds when polarity is unchanged. - Tests: same-polarity move must not clear, no-flip cancel must quit without clear, chrome polarity adaptation, renderer rebuild elision.
|
Addressed the adversarial review:
New tests cover all three; tui suite + race + vet + release build green. |
Follow-up to #195, which made light↔dark switching look broken.
Problem
After
/themeswitches between light and dark themes, the UI showed gray/blackcutoutblocks: the picker surface kept one polarity while row styles flipped to the other, and stale cells from the previous theme lingered on screen.Root cause
SurfaceDarkbackgrounds to nested containers (pickerBox,inputBoxStyle). Nested styled spans emit ANSI reset sequences that interrupt the inherited parent background, so the terminal's native background punches through around every styled label — visible as cutout blocks on any polarity mismatch.Fix
pickerBox,inputBoxStyle) are transparent again; only leaf surfaces (statusBarStyle,statusMetricsStyle) keep solid backgrounds — they have no nested styled children, so resets cannot cut holes in them.tea.ClearScreenon every navigation step and on Escape-cancel, so the whole visible frame is repainted in the new polarity instead of leaving stale cells.Known limitation
Text already printed into scrollback keeps the colors it was printed with — ANSI cannot restyle scrolled-out history; only the visible frame is repainted. This is inherent to terminals, not fixable in-app.
Tests
TestApplyTheme_BackgroundOwnership— containers transparent, leaf surfaces solid, across all 10 themesTestThemePicker_PolarityTransitionsRequestFullRepaint— dark→light→dark preview transitions must emit a full-repaint commandTestThemePalette_SelectionContrastsSurfacerationaleVerification
go test ./internal/tui,go test -race ./internal/tui,go vet ./..., release-style build, andgit diff --checkall pass.