fix(tui): detect nested markdown lists structurally, not by ANSI color#6359
Conversation
🟡 PR Risk Report — MEDIUM
Affected Systems
File Breakdown
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR fixes three P0 issues from a TUI audit: overlay cache invalidation preventing dismissal redraws, select-list state corruption on empty filters, and markdown nested-list detection pitfalls. Changes span render-engine state tracking, input handling guards, and rendering logic refactors. ChangesTUI Audit Phase 0 Fixes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
The doRender() short-circuit skipped all post-processing when component output was byte-identical to the previous frame. If the previous frame composited an overlay onto the screen, an identical next frame with no overlay would short-circuit and never erase it, leaving the overlay stuck on screen. Track _lastFrameHadOverlays and force a redraw when the previous frame drew an overlay, even if base component output is unchanged.
When a filter matched no items, selectUp set selectedIndex to filteredItems.length - 1 (i.e. -1), corrupting list state until the next setFilter() reset it. Skip navigation and selection entirely when the filtered list is empty; still honor cancel.
renderList() identified nested-list lines with the regex /^\s+\x1b\[36m[-\d]/ — assuming the list bullet is always ANSI cyan. Any theme with a different bullet color silently broke nested-list indentation. renderListItem() now returns ListItemLine[] with a 'nested' flag set on lines produced by recursive renderList() calls, so renderList() keys off structure instead of pattern-matching theme output.
297e099 to
224fb40
Compare
Stack — TUI Phase 0 (4/8)
Builds on #6358. Stacked branch — diff also includes commits below it until they merge.
Problem
renderList()identified nested-list lines with the regex/^\s+\x1b\[36m[-\d]/— assuming the list bullet is always ANSI cyan. Any theme with a different bullet color silently broke nested-list indentation.Fix
renderListItem()now returnsListItemLine[]with anestedflag set on lines produced by recursiverenderList()calls.renderList()keys off structure instead of pattern-matching theme output.Test
Verified manually with a non-cyan (magenta) bullet theme — nested items indent correctly.
packages/pi-tuisuite passes.Summary by CodeRabbit