fix(widgets): preserve fractional start positions in GanttChart-#2436#2926
fix(widgets): preserve fractional start positions in GanttChart-#2436#2926Rakshak05 wants to merge 4 commits into
Conversation
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughGanttChart bar rendering now accounts for fractional task start positions using eight subcells per cell. Terminal capability overrides support Unicode and ASCII rendering tests, which cover fractional alignment in both modes. ChangesGanttChart sub-cell alignment
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@packages/widgets/src/data/GanttChart.test.ts`:
- Line 105: Replace the plain data-property test seam for caps.unicode with a
supported getter accessor in the env-caps implementation, or provide an
equivalent accessor-based seam. Update all repeated vi.spyOn(caps, "unicode",
"get") mocks in Histogram, StackedBarChart, GanttChart, and Tooltip tests to
target that seam.
In `@packages/widgets/src/data/GanttChart.ts`:
- Around line 163-180: The partial-bar glyph selection in GanttChart must
incorporate both cellStart and width instead of choosing solely by width,
preserving distinct alignments including right-aligned 7/8 segments; update the
logic around the cellEnd === 8 and middle-block branches accordingly. In
packages/widgets/src/data/GanttChart.test.ts lines 94-100, replace the
full-block-only expectation with cases demonstrating that same-width bars at
different fractional starts render different glyphs.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 115e49c3-70fa-4177-85f3-d99db419cddb
📒 Files selected for processing (2)
packages/widgets/src/data/GanttChart.test.tspackages/widgets/src/data/GanttChart.ts
…rrides compatibility
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/core/src/terminal/env-caps.ts (1)
3-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake capability overrides resettable.
After either setter is called, the corresponding mock permanently overrides environment detection for the module lifetime. This can leak test state and prevents restoring
NO_UNICODE/TERM/NO_MOTION/CI-derived behavior. Acceptundefinedas a reset value or add an explicit reset helper, with tests for both paths.Also applies to: 29-39
🤖 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 `@packages/core/src/terminal/env-caps.ts` around lines 3 - 5, The capability override state in mockUnicode and mockMotion is not resettable, causing test state to persist across module use. Update the corresponding setter functions to accept undefined and clear their override when provided, or add an explicit reset helper, while preserving environment-based detection when no override is set; add tests covering setting overrides and restoring both Unicode and motion detection.
🤖 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 `@packages/core/src/terminal/env-caps.ts`:
- Around line 29-30: Update the exported caps object around the unicode setter
and related runtime setters so its public TypeScript type keeps direct overrides
writable. Remove the readonly inference caused by as const, or expose the object
through an explicit writable Caps type, while preserving the existing setter
behavior for caps.unicode, caps.motion, and other mutable members.
---
Nitpick comments:
In `@packages/core/src/terminal/env-caps.ts`:
- Around line 3-5: The capability override state in mockUnicode and mockMotion
is not resettable, causing test state to persist across module use. Update the
corresponding setter functions to accept undefined and clear their override when
provided, or add an explicit reset helper, while preserving environment-based
detection when no override is set; add tests covering setting overrides and
restoring both Unicode and motion detection.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ef3d6cfd-b926-455b-b128-a35d6552cd4e
📒 Files selected for processing (3)
packages/core/src/terminal/env-caps.tspackages/widgets/src/data/GanttChart.test.tspackages/widgets/src/data/GanttChart.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/widgets/src/data/GanttChart.test.ts
- packages/widgets/src/data/GanttChart.ts
…for tests compatibility
|
Thanks — the GanttChart fractional-start fix is correct (sub-cell overlap math verified, both unicode and ASCII paths, two focused tests pass). One blocker: the PR also bundles an unrelated refactor of Checklist: [ ] env-caps.ts changes reverted [ ] only GanttChart.ts + test remain |
Description
This PR fixes an issue where the
GanttChartwidget ignored fractional task start positions because it rounded the starting column down usingMath.floor. The rendering logic was rewritten to calculate both start positions and durations in sub-cells (8 per column) and render appropriate fractional block symbols (▐,▕, and standard left-aligned bar symbols) depending on the alignment.Related Issue
Closes #2436
Which package(s)?
@termuijs/widgets
Type of Change
type:bug)type:feature)type:docs)type:testing)type:refactor)type:design)type:accessibility)type:performance)type:devops)type:security)Checklist
needs-starcheck blocks your merge otherwise.bun vitest runbun run buildbun run typecheckCONTRIBUTING.md.type: short description.markDirty()(if your change affects rendering).anytypes without an inline comment explaining why.GSSoC 2026 Participation
https://gssoc.girlscript.org/profile/e3386d85-b6ea-4c6e-b3c9-1c559eea6b33Screenshots / Recordings (UI changes)
Notes for the Reviewer
Math.round(cols * 8)).cellStart > 0), it renders the corresponding right-aligned block character\u2595(▕) for width <= 2,\u2590(▐) for width <= 5, and full block\u2588(█) for width >= 6.=and-characters whencaps.unicodeis false.Summary by CodeRabbit