Skip to content

Conversation

@newhook
Copy link
Owner

@newhook newhook commented Jan 15, 2026

Summary

Adds two new fields to the beadItem struct in cmd/tui_shared.go to support proper tree rendering in the TUI:

  • isLastChild bool - Indicates if a bead is the last child of its parent
  • treePrefixPattern string - Stores the precomputed tree prefix pattern (e.g., "│ └─")

These fields enable proper visualization of tree structures in the TUI, allowing correct branch/continuation characters to be displayed during tree traversal.

Changes

  • cmd/tui_shared.go: Added isLastChild and treePrefixPattern fields to beadItem struct (lines 177-178)

Issues Resolved

  • Closes ac-g15b: Add isLastChild and treePrefixPattern fields to beadItem for proper tree rendering

Notes

This is a preparatory change that adds the data structure fields. A follow-up issue (ac-ecyi) will implement the computation of sibling position and ancestor continuation during the buildBeadTree DFS traversal.

Testing

  • Build verified: go build -o co . completes successfully
  • Existing tests pass: go test ./...

🤖 Generated with Claude Code

newhook and others added 3 commits January 14, 2026 23:33
Added two new fields to support proper tree rendering:
- isLastChild bool: indicates if this bead is the last child of its parent
- treePrefixPattern string: precomputed tree prefix pattern (e.g., "│ └─")

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Modified buildBeadTree DFS to compute isLastChild and treePrefixPattern
for each bead based on sibling position and ancestor continuation.
Updated renderBeadLine to use the precomputed pattern instead of simple
depth-based indentation.

Closes: ac-ecyi, ac-v9q3, ac-pehr

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Sort roots to visit closed parents first, ensuring their open children
  appear under them rather than under other open parents
- Filter out closed parents that end up with no visible children (when
  their children were already visited under different parents)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@newhook newhook merged commit e767881 into main Jan 15, 2026
@newhook newhook deleted the feat/add-islastchild-and-treeprefixpattern-fields-to-be branch January 16, 2026 01:43
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